doctrine/orm · error · InvalidArgumentException

Unknown result variable: %s

Error message

Unknown result variable: %s

What it means

Error "Unknown result variable: %s" thrown in doctrine/orm.

Source

Thrown at src/Query/SqlWalker.php:2298

    }

    /**
     * Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.
     */
    public function walkStringPrimary(AST\Node|string $stringPrimary): string
    {
        return is_string($stringPrimary)
            ? $this->conn->quote($stringPrimary)
            : $stringPrimary->dispatch($this);
    }

    /**
     * Walks down a ResultVariable that represents an AST node, thereby generating the appropriate SQL.
     */
    public function walkResultVariable(string $resultVariable): string
    {
        if (! isset($this->scalarResultAliasMap[$resultVariable])) {
            throw new InvalidArgumentException(sprintf('Unknown result variable: %s', $resultVariable));
        }

        $resultAlias = $this->scalarResultAliasMap[$resultVariable];

        if (is_array($resultAlias)) {
            return implode(', ', $resultAlias);
        }

        return $resultAlias;
    }

    /**
     * @return string The list in parentheses of valid child discriminators from the given class
     *
     * @throws QueryException
     */
    private function getChildDiscriminatorsFromClassMetadata(
        ClassMetadata $rootClass,

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Query/SqlWalker.php:2298 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of doctrine/orm@d9b9ff7301 (2026-08-21). Data as JSON: /api/errors/a215f1f58a0bd5dd. Report an issue: GitHub.