phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\UnknownPhqlExpression

Unknown expression

Error message

Unknown expression

What it means

Generic sentinel thrown at the end of Query::getExpression: the expression node carries neither a recognized type key nor a numeric node list (expr[0]), so it cannot be classified. The input at fault is a malformed or truncated PHQL AST node.

Solutions

  1. Review the PHQL statement for malformed constructs (e.g. dangling operators, empty parentheses).
  2. Ensure the AST was not manually edited or produced by a mismatched Phalcon version.
  3. Catch the exception and log the offending PHQL to reproduce the parser issue.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Query.zep:2426 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/944df12b804e55dd. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Model/Query.zep:2426

        }

        /**
         * If the expression does not have a type it's a list of nodes
         */
        if isset expr[0] {
            let listItems = [];

            for exprListItem in expr {
                let listItems[] = this->getExpression(exprListItem);
            }

            return [
                "type": "list",
                listItems
            ];
        }

        throw new UnknownPhqlExpression();
    }

    /**
     * Resolves an expression in a single call argument
     */
    final protected function getFunctionCall( array expr) -> array
    {
        var arguments, argument;
        array functionArgs;
        int distinct;

        if fetch arguments, expr["arguments"] {
            if isset expr["distinct"] {
                let distinct = 1;
            } else {
                let distinct = 0;
            }

View on GitHub (pinned to b7419de9cd)