phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\UnknownPhqlExpressionType
Unknown expression type
Error message
Unknown expression type {type} What it means
Generic guard in Query::getExpression's default branch: the PHQL parser produced an expression token type (exprType) that the query analyzer has no case for, meaning the AST is malformed or generated by an incompatible parser version. The offending input is the parsed PHQL expression.
Solutions
- Inspect the PHQL string for syntax the parser cannot handle and simplify or rewrite the expression.
- Verify the Phalcon version generating and consuming the AST matches; clear any cached PHQL/AST between upgrades.
- Wrap query preparation in try/catch and log the full PHQL for diagnosis.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query.zep:2397 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/3f9b8a30e161ce28.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Query.zep:2397
let exprReturn = this->getFunctionCall(expr);
break;
case PHQL_T_CASE:
let exprReturn = this->getCaseExpression(expr);
break;
case PHQL_T_SELECT:
let exprReturn = [
"type": "select",
"value": this->prepareSelect(expr, true)
];
break;
default:
throw new UnknownPhqlExpressionType(exprType);
}
return exprReturn;
}
/**
* It's a qualified column
*/
if isset expr["domain"] {
return this->getQualified(expr);
}
/**
* If the expression does not have a type it's a list of nodes
*/
if isset expr[0] {
let listItems = [];
View on GitHub (pinned to b7419de9cd)