getgrav/grav · error · RuntimeException

Failed to load console commands for plugin {$name}

Error message

Failed to load console commands for plugin {$name}

What it means

Error "Failed to load console commands for plugin {$name}" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php:44

    /** @var array */
    private $commands;

    /**
     * PluginCommandLoader constructor.
     *
     * @param string $name
     */
    public function __construct(string $name)
    {
        $this->commands = [];

        try {
            $path = "plugins://{$name}/cli";
            $pattern = '([A-Z]\w+Command\.php)';

            $commands = is_dir($path) ? Folder::all($path, ['compare' => 'Filename', 'pattern' => '/' . $pattern . '$/usm', 'levels' => 1]) : [];
        } catch (RuntimeException $e) {
            throw new RuntimeException("Failed to load console commands for plugin {$name}");
        }

        $grav = Grav::instance();

        /** @var UniformResourceLocator $locator */
        $locator = $grav['locator'];
        foreach ($commands as $command_path) {
            $full_path = $locator->findResource("plugins://{$name}/cli/{$command_path}");
            require_once $full_path;

            $command_class = 'Grav\Plugin\Console\\' . preg_replace('/.php$/', '', (string) $command_path);
            if (class_exists($command_class)) {
                $command = new $command_class();
                if ($command instanceof Command) {
                    $this->commands[$command->getName()] = $command;

                    // If the command has an alias, add that as a possible command name.
                    $aliases = $this->commands[$command->getName()]->getAliases();

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php:44 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17). Data as JSON: /api/errors/79125a86f75b2522. Report an issue: GitHub.