symfony/translation · error · UnsupportedSchemeException
The scheme "null" is not supported by this provider.
Error message
The scheme "null" is not supported by this provider.
What it means
Thrown by NullProviderFactory::create() when a Dsn whose scheme is not 'null' is passed to the factory. The factory only supports the 'null' scheme (used to disable translation providers); any other scheme is unsupported and surfaces as UnsupportedSchemeException.
Solutions
- Ensure the DSN scheme matches the factory: use scheme 'null' for NullProviderFactory
- Use the correct provider factory for the scheme (loco, locomotive, acfred, crowdin, etc.)
- If you intend no provider, set the DSN to 'null://default'
Example fix
// before
$factory->create(new Dsn('loco://KEY@default'));
// after
$factory->create(new Dsn('null://default')); // or use LocoProviderFactory Defensive patterns
Strategy: type-guard
Validate before calling
if ($dsn->getScheme() !== 'null') {
throw new \LogicException('NullProviderFactory only handles the null scheme.');
} Type guard
$scheme = $dsn->getScheme();
if ($scheme !== 'null') { /* route to correct factory */ } Try / catch
try {
$provider = $factory->create($dsn);
} catch (UnsupportedSchemeException $e) {
// fall back to the factory whose supported schemes contain $dsn->getScheme()
} Prevention
- Match factories to schemes explicitly instead of hardcoding one factory
- Check supports($dsn) before calling create()
- Keep DSN schemes aligned with the provider packages you install
When it happens
Trigger: Calling create($dsn) on a NullProviderFactory (or a provider factory whose getSupportedSchemes() is ['null']) with a Dsn whose getScheme() is not 'null'.
Common situations: Routing a DSN like 'loco://key@default' to the wrong factory, misconfigured provider factory services, or custom factories delegating to NullProviderFactory.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Provider " " not found. Available: " ".
- The scheme is not supported by any provider.
- The " ()" method cannot be called as the wrapped translator…
- No loader is registered for the
- No loader is registered for the
AI-assisted analysis of symfony/translation@ae9e8a51bc (2026-09-15).
Data as JSON: /api/errors/2785c2e7809c5333.
Report an issue: GitHub.
Appendix: source
Thrown at Provider/NullProviderFactory.php:27
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Provider;
use Symfony\Component\Translation\Exception\UnsupportedSchemeException;
/**
* @author Mathieu Santostefano <msantostefano@protonmail.com>
*/
final class NullProviderFactory extends AbstractProviderFactory
{
public function create(Dsn $dsn): ProviderInterface
{
if ('null' === $dsn->getScheme()) {
return new NullProvider();
}
throw new UnsupportedSchemeException($dsn, 'null', $this->getSupportedSchemes());
}
protected function getSupportedSchemes(): array
{
return ['null'];
}
}
View on GitHub (pinned to ae9e8a51bc)