yiisoft/yii2 · error · yii\base\InvalidConfigException

Invalid CAPTCHA action ID: {$this->captchaAction}

Error message

Invalid CAPTCHA action ID: {$this->captchaAction}

What it means

Error "Invalid CAPTCHA action ID: {$this->captchaAction}" thrown in yiisoft/yii2.

Source

Thrown at framework/captcha/CaptchaValidator.php:84

    }

    /**
     * Creates the CAPTCHA action object from the route specified by [[captchaAction]].
     * @return CaptchaAction the action object
     * @throws InvalidConfigException
     */
    public function createCaptchaAction()
    {
        $ca = Yii::$app->createController($this->captchaAction);
        if ($ca !== false) {
            list($controller, $actionID) = $ca;
            /** @var CaptchaAction|null $action */
            $action = $controller->createAction($actionID);
            if ($action !== null) {
                return $action;
            }
        }
        throw new InvalidConfigException('Invalid CAPTCHA action ID: ' . $this->captchaAction);
    }

    /**
     * {@inheritdoc}
     */
    public function clientValidateAttribute($model, $attribute, $view)
    {
        ValidationAsset::register($view);
        $options = $this->getClientOptions($model, $attribute);

        return 'yii.validation.captcha(value, messages, ' . Json::htmlEncode($options) . ');';
    }

    /**
     * {@inheritdoc}
     */
    public function getClientOptions($model, $attribute)
    {

View on GitHub (pinned to 66f00d18a2)

When it happens

Trigger: Thrown at framework/captcha/CaptchaValidator.php:84 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/4830840184577c98. Report an issue: GitHub.