laravel/framework · error · InvalidArgumentException

Console component [%s] not found.

Error message

Console component [%s] not found.

What it means

Thrown by Console\View\Components\Factory::__call when you invoke a method on the output factory (e.g. $this->components->foo()) whose name does not map to an existing class in Illuminate\Console\View\Components. The factory builds a class name by upper-casing the first letter of the called method and checking class_exists(); if no such component class exists it throws InvalidArgumentException. The built-in components are alert, ask, askWithCompletion, bulletList, choice, confirm, info, success, error, line, secret, task, twoColumnDetail, and warn.

Source

Thrown at src/Illuminate/Console/View/Components/Factory.php:56

    {
        $this->output = $output;
    }

    /**
     * Dynamically handle calls into the component instance.
     *
     * @param  string  $method
     * @param  array  $parameters
     * @return mixed
     *
     * @throws \InvalidArgumentException
     */
    public function __call($method, $parameters)
    {
        $component = '\Illuminate\Console\View\Components\\'.ucfirst($method);

        if (! class_exists($component)) {
            throw new InvalidArgumentException(sprintf(
                'Console component [%s] not found.', $method
            ));
        }

        return (new $component($this->output))->render(...$parameters);
    }
}

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Check the method spelling against the documented component list (alert, ask, askWithCompletion, bulletList, choice, confirm, error, info, line, secret, success, task, twoColumnDetail, warn).
  2. Run composer show laravel/framework to confirm the installed version supports the component you are calling.
  3. Use the raw Symfony output style ($this->output->writeln or $this->info) for any message shape not covered by a built-in component.
  4. If you need a custom component, create the class under Illuminate\Console\View\Components (or extend the factory) and call a method matching its classname.

Example fix

// before
$this->components->progess('Done'); // typo

// after
$this->components->task('Done', fn () => true);
Defensive patterns

Strategy: validation

Validate before calling

$component = ucfirst($method);
if (! class_exists("\\Illuminate\\Console\\View\\Components\\{$component}")) {
    $this->output->writeln("<error>Unknown console component: {$method}</error>");
    return;
}
$this->components->{$method}(...$args);

Type guard

function isKnownConsoleComponent(string $method): bool
{
    return class_exists('\\Illuminate\\Console\\View\\Components\\'.ucfirst($method));
}

Try / catch

try {
    $this->components->{$method}($message);
} catch (\InvalidArgumentException $e) {
    if (str_contains($e->getMessage(), 'Console component')) {
        $this->output->writeln($message);
    } else {
        throw $e;
    }
}

Prevention

When it happens

Trigger: Calling any undefined component method on the Factory proxy, e.g. $this->components->progress('done') or $this->components->header() inside an Artisan command, where the corresponding \Illuminate\Console\View\Components\Progress or \Header class is not present. Also triggered by typos: $this->components->inf() instead of info().

Common situations: Typo in a command that uses the new Laravel 9+ component syntax; using a component name that only exists in a newer/older framework version than the installed one; a custom command expecting a component that was never registered; copy-pasting example code from docs targeting a newer Laravel version.

Related errors


AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06). Data as JSON: /data/errors/8f16ff8c35b0491b.json. Report an issue: GitHub.