passbolt/passbolt_api · info

and that Psy\Shell is registered in your autoloader.

Error message

and that Psy\Shell is registered in your autoloader.

What it means

Third guidance line from ConsoleCommand: 'and that Psy\Shell is registered in your autoloader.' It points out that even with psysh on disk, the composer autoloader must know the class. Informational stderr output only.

Solutions

  1. Run composer install/update so the autoloader includes psysh.
  2. Run composer dump-autoload after manual vendor changes.
  3. Confirm the app uses the generated vendor/autoload.php (APP/composer settings).
Defensive patterns

Strategy: fallback

Validate before calling

// Verify autoload coverage before invoking console
require CONFIG . '../vendor/autoload.php';
var_dump(class_exists('Psy\Shell'));

Prevention

When it happens

Trigger: `bin/cake passbolt console` where Psy\Shell is absent from the loaded autoloader — either not installed or autoload files stale/not regenerated.

Common situations: Manually copying vendor directories, using a custom autoloader, or editing composer.json without running composer install/update.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/8c9427e8abca7c83. Report an issue: GitHub.

Appendix: source

Thrown at src/Command/ConsoleCommand.php:45

/**
 * Simple console wrapper around Psy\Shell.
 */
class ConsoleCommand extends Command
{
    /**
     * Start the Command and interactive console.
     *
     * @param \Cake\Console\Arguments $args The command arguments.
     * @param \Cake\Console\ConsoleIo $io The console io
     * @return int|null|void The exit code or null for success
     */
    public function execute(Arguments $args, ConsoleIo $io) // phpcs:ignore
    {
        if (!class_exists('Psy\Shell')) {
            $io->err('<error>Unable to load Psy\Shell.</error>');
            $io->err('');
            $io->err('Make sure you have installed psysh as a dependency,');
            $io->err('and that Psy\Shell is registered in your autoloader.');
            $io->err('');
            $io->err('If you are using composer run');
            $io->err('');
            $io->err('<info>$ php composer.phar require psy/psysh</info>');
            $io->err('');

            return static::CODE_ERROR;
        }

        $io->out('You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>');
        $io->out();

        Log::drop('debug');
        Log::drop('error');
        $io->setLoggers(false);
        restore_error_handler();
        restore_exception_handler();

View on GitHub (pinned to 31c1bbc10f)