yiisoft/yii2 · error · Exception

You should specify cache components names

Error message

You should specify cache components names

What it means

Error "You should specify cache components names" thrown in yiisoft/yii2.

Source

Thrown at framework/console/controllers/CacheController.php:83

        }
    }

    /**
     * Flushes given cache components.
     *
     * For example,
     *
     * ```
     * # flushes caches specified by their id: "first", "second", "third"
     * yii cache/flush first second third
     * ```
     */
    public function actionFlush()
    {
        $cachesInput = func_get_args();

        if (empty($cachesInput)) {
            throw new Exception('You should specify cache components names');
        }

        $caches = $this->findCaches($cachesInput);
        $cachesInfo = [];

        $foundCaches = array_keys($caches);
        $notFoundCaches = array_diff($cachesInput, array_keys($caches));

        if ($notFoundCaches !== []) {
            $this->notifyNotFoundCaches($notFoundCaches);
        }

        if ($foundCaches === []) {
            $this->notifyNoCachesFound();
            return ExitCode::OK;
        }

        if (!$this->confirmFlush($foundCaches)) {

View on GitHub (pinned to 66f00d18a2)

When it happens

Trigger: Thrown at framework/console/controllers/CacheController.php:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17). Data as JSON: /api/errors/a6dff34ea3a429f0. Report an issue: GitHub.