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

Eager loading the relation '{alias}' requires the column '{c

Error message

Eager loading the relation '{alias}' requires the column '{column}' to be present in the selected columns

What it means

Error "Eager loading the relation '{alias}' requires the column '{column}' to be present in the selected columns" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model/Eager/Loader.zep:475

    protected function collectKeys(
        array parents,
        array fields,
        string alias
    ) -> array {
        var field, parent, value;
        array seen, values;

        let seen = [];

        for parent in parents {
            let values = [];

            for field in fields {
                if typeof parent === "object" {
                    let value = parent->readAttribute(field);
                } else {
                    if unlikely !array_key_exists(field, parent) {
                        throw new MissingEagerKeyColumn(alias, field);
                    }

                    let value = parent[field];
                }

                let values[] = value;
            }

            if in_array(null, values, true) {
                continue;
            }

            let seen[self::buildKey(values)] = values;
        }

        return array_values(seen);
    }

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Eager/Loader.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/2b16592d6ddd66de. Report an issue: GitHub.