symfony/translation · error · InvalidArgumentException

Provider " " not found. Available: " ".

Error message

Provider "%s" not found. Available: "%s".

What it means

Thrown by TranslationProviderCollection::get() when requesting a provider by name that is not registered in the collection. The message lists available provider names via the collection's string representation.

Solutions

  1. Check the exact provider name with $collection->keys() (names are listed in the exception)
  2. Verify the provider is configured under framework.translator.providers in config/packages/translation.yaml
  3. Call has($name) before get($name) in custom code

Example fix

// before
$provider = $collection->get('acme'); // not registered
// after
if ($collection->has('acf')) {
    $provider = $collection->get('acf');
}
Defensive patterns

Strategy: validation

Validate before calling

if (!$collection->has($name)) {
    $name = $collection->keys()[0] ?? throw new \RuntimeException('No providers configured.');
}

Try / catch

try {
    $provider = $collection->get($name);
} catch (InvalidArgumentException $e) {
    // log available: (string) $collection, then rethrow or default
}

Prevention

When it happens

Trigger: Calling get($name) where has($name) is false — i.e. no provider service with that name exists in the collection.

Common situations: Typo in the provider name passed to translator provider commands (translation:extract, provider write/read), provider not configured under framework.translator.providers, or wrong service tag wiring.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of symfony/translation@ae9e8a51bc (2026-09-15). Data as JSON: /api/errors/0776a317635ff035. Report an issue: GitHub.

Appendix: source

Thrown at Provider/TranslationProviderCollection.php:47

    public function __construct(iterable $providers)
    {
        $this->providers = \is_array($providers) ? $providers : iterator_to_array($providers);
    }

    public function __toString(): string
    {
        return '['.implode(',', array_keys($this->providers)).']';
    }

    public function has(string $name): bool
    {
        return isset($this->providers[$name]);
    }

    public function get(string $name): ProviderInterface
    {
        if (!$this->has($name)) {
            throw new InvalidArgumentException(\sprintf('Provider "%s" not found. Available: "%s".', $name, (string) $this));
        }

        return $this->providers[$name];
    }

    public function keys(): array
    {
        return array_keys($this->providers);
    }
}

View on GitHub (pinned to ae9e8a51bc)