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

Only PHQL statements that return resultsets can be cached

Error message

Only PHQL statements that return resultsets can be cached

What it means

Error "Only PHQL statements that return resultsets can be cached" thrown in phalcon/cphalcon.

Source

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

                    mergedParams,
                    mergedTypes
                );

                break;

            default:
                throw new UnknownPhqlStatement(type);
        }

        /**
         * We store the resultset in the cache if any
         */
        if cacheOptions !== null {
            /**
             * Only PHQL SELECTs can be cached
             */
            if type != PHQL_T_SELECT {
                throw new ResultsetNonCacheable();
            }

            cache->set(key, result, lifetime);
        }

        /**
         * Check if only the first row must be returned
         */
        if uniqueRow {
            let preparedResult = result->getFirst();
        } else {
            let preparedResult = result;
        }

        return preparedResult;
    }

    /**

View on GitHub (pinned to b7419de9cd)

When it happens

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