I was stupid, and had a specific notice issue in my sites.php for an array key that does not exists. If I run a CLI based app (in my case Drupal console) then I get the following
Error: Cannot use object of type Drupal\Console\Config as array in /app/project/repository/web/core/includes/errors.inc on line 319
Error: Cannot use object of type Drupal\Console\Config as array in _drupal_get_error_level() (line 319 of /app/project/repository/web/core/includes/errors.inc).
That line contains:
$error_level = isset($GLOBALS['config']['system.logging']['error_level']) ? $GLOBALS['config']['system.logging']['error_level'] : ERROR_REPORTING_HIDE;
In my case, the Config object exists (is not an array) but the error has occured before container initialization (I think) so I get the above error.
If that error_level line is a bit more picky:
$error_level = (is_array($GLOBALS['config']) || ($GLOBALS['config'] instanceof ArrayAccess)) && isset($GLOBALS['config']['system.logging']['error_level']) ? $GLOBALS['config']['system.logging']['error_level'] : ERROR_REPORTING_HIDE;
Then I get the proper notice that I've put some garbage into my sites.php.
In my case I had some code that made sense in the FPM case, but not in the CLI case (I was accessing $_SERVER['HTTP_HOST'])