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

Eager loading does not support the 'offset' option: a…

Error message

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

What it means

Thrown by PathTree::assertOptions() when an eager path's option map contains 'offset'. Like 'limit', an offset only makes sense per parent and would require a window function PHQL cannot express; a batch-level offset would silently skip the wrong rows, so the option is rejected.

Solutions

  1. Remove the 'offset' option from the eager loading spec
  2. Apply any needed skipping logic to the hydrated children in application code
  3. Use a raw SQL query with window functions when true pagination per parent is needed
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        }

        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,
        int index,
        array options
    ) -> array {
        var node, segment;

View on GitHub (pinned to b7419de9cd)