phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\UnsupportedEagerOption

Eager loading does not support the 'limit' option: a per-par

Error message

Eager loading does not support the 'limit' option: a per-parent limit requires a window function, which PHQL cannot express

What it means

Error "Eager loading does not support the 'limit' option: a per-parent limit requires a window function, which PHQL cannot express" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model/Eager/PathTree.zep:87

                throw new InvalidEagerPath(path);
            }

            let tree = self::insert(tree, path, segments, 0, options);
        }

        return tree;
    }

    /**
     * A per-parent limit requires ROW_NUMBER() OVER (PARTITION BY ...), which
     * PHQL has no syntax for. Applying `limit` to the batch query instead
     * would return N children in total rather than N per parent, which is
     * silently wrong.
     */
    private static function assertOptions(array options) -> void
    {
        if unlikely isset options["limit"] {
            throw new UnsupportedEagerOption("limit");
        }

        if unlikely isset options["offset"] {
            throw new UnsupportedEagerOption("offset");
        }
    }

    /**
     * @param array  $tree     accumulated tree
     * @param string $path     the original path, for error messages
     * @param array  $segments exploded path
     * @param int    $index    segment currently being inserted
     * @param array  $options  attach to the last segment only
     */
    private static function insert(
        array tree,
        string path,
        array segments,

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Eager/PathTree.zep:87 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/8c3f2a4a8ae516dc. Report an issue: GitHub.