{"record":{"id":"a95cfb1527851a0e","repo":"yiisoft/yii2","slug":"expression-of-class-can-not-be-built-in","errorCode":null,"errorMessage":"Expression of class {} can not be built in {}","messagePattern":"Expression of class (.+?) can not be built in (.+?)","errorType":"exception","errorClass":"yii\\base\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"framework/db/QueryBuilder.php","lineNumber":316,"sourceCode":"     * @return ExpressionBuilderInterface\n     * @throws InvalidArgumentException when $expression building is not supported by this QueryBuilder.\n     * @since 2.0.14\n     * @see expressionBuilders\n     */\n    public function getExpressionBuilder(ExpressionInterface $expression)\n    {\n        $className = get_class($expression);\n\n        if (!isset($this->expressionBuilders[$className])) {\n            foreach (array_reverse($this->expressionBuilders) as $expressionClass => $builderClass) {\n                if (is_subclass_of($expression, $expressionClass)) {\n                    $this->expressionBuilders[$className] = $builderClass;\n                    break;\n                }\n            }\n\n            if (!isset($this->expressionBuilders[$className])) {\n                throw new InvalidArgumentException('Expression of class ' . $className . ' can not be built in ' . get_class($this));\n            }\n        }\n\n        if ($this->expressionBuilders[$className] === __CLASS__) {\n            /** @var $this&ExpressionBuilderInterface $result */\n            $result = $this;\n            return $result;\n        }\n\n        if (!is_object($this->expressionBuilders[$className])) {\n            $this->expressionBuilders[$className] = new $this->expressionBuilders[$className]($this);\n        }\n\n        return $this->expressionBuilders[$className];\n    }\n\n    /**\n     * Creates an INSERT SQL statement.","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/QueryBuilder.php#L298-L334","documentation":"Error \"Expression of class {} can not be built in {}\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/db/QueryBuilder.php:316 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}