doctrine/orm · error · InvalidArgumentException

Entity name "%s" is ambiguous, possible matches: "%s"

Error message

Entity name "%s" is ambiguous, possible matches: "%s"

What it means

Error "Entity name "%s" is ambiguous, possible matches: "%s"" thrown in doctrine/orm.

Source

Thrown at src/Tools/Console/Command/MappingDescribeCommand.php:254

        try {
            return $entityManager->getClassMetadata($entityName);
        } catch (MappingException) {
        }

        $matches = array_filter(
            $this->getMappedEntities($entityManager),
            static fn ($mappedEntity) => preg_match('{' . preg_quote($entityName) . '}', $mappedEntity),
        );

        if (! $matches) {
            throw new InvalidArgumentException(sprintf(
                'Could not find any mapped Entity classes matching "%s"',
                $entityName,
            ));
        }

        if (count($matches) > 1) {
            throw new InvalidArgumentException(sprintf(
                'Entity name "%s" is ambiguous, possible matches: "%s"',
                $entityName,
                implode(', ', $matches),
            ));
        }

        return $entityManager->getClassMetadata(current($matches));
    }

    /**
     * Format the given value for console output
     */
    private function formatValue(mixed $value): string
    {
        if ($value === '') {
            return '';
        }

View on GitHub (pinned to d9b9ff7301)

When it happens

Trigger: Thrown at src/Tools/Console/Command/MappingDescribeCommand.php:254 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/bee849ee862c7811. Report an issue: GitHub.