{"record":{"id":"2785c2e7809c5333","repo":"symfony/translation","slug":"the-scheme-null-is-not-supported-by-this-provider","errorCode":null,"errorMessage":"The scheme \"null\" is not supported by this provider.","messagePattern":"The scheme \"null\" is not supported by this provider\\.","errorType":"exception","errorClass":"UnsupportedSchemeException","httpStatus":null,"severity":"error","filePath":"Provider/NullProviderFactory.php","lineNumber":27,"sourceCode":" * file that was distributed with this source code.\n */\n\nnamespace Symfony\\Component\\Translation\\Provider;\n\nuse Symfony\\Component\\Translation\\Exception\\UnsupportedSchemeException;\n\n/**\n * @author Mathieu Santostefano <msantostefano@protonmail.com>\n */\nfinal class NullProviderFactory extends AbstractProviderFactory\n{\n    public function create(Dsn $dsn): ProviderInterface\n    {\n        if ('null' === $dsn->getScheme()) {\n            return new NullProvider();\n        }\n\n        throw new UnsupportedSchemeException($dsn, 'null', $this->getSupportedSchemes());\n    }\n\n    protected function getSupportedSchemes(): array\n    {\n        return ['null'];\n    }\n}\n","sourceCodeStart":9,"sourceCodeEnd":35,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Provider/NullProviderFactory.php#L9-L35","documentation":"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.","triggerScenarios":"Calling create($dsn) on a NullProviderFactory (or a provider factory whose getSupportedSchemes() is ['null']) with a Dsn whose getScheme() is not 'null'.","commonSituations":"Routing a DSN like 'loco://key@default' to the wrong factory, misconfigured provider factory services, or custom factories delegating to NullProviderFactory.","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'"],"exampleFix":"// before\n$factory->create(new Dsn('loco://KEY@default'));\n// after\n$factory->create(new Dsn('null://default')); // or use LocoProviderFactory","handlingStrategy":"type-guard","validationCode":"if ($dsn->getScheme() !== 'null') {\n    throw new \\LogicException('NullProviderFactory only handles the null scheme.');\n}","typeGuard":"$scheme = $dsn->getScheme();\nif ($scheme !== 'null') { /* route to correct factory */ }","tryCatchPattern":"try {\n    $provider = $factory->create($dsn);\n} catch (UnsupportedSchemeException $e) {\n    // fall back to the factory whose supported schemes contain $dsn->getScheme()\n}","preventionTips":["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"],"tags":["php","symfony","translation","scheme"],"backgroundTag":"unsupported-operation","analyzedSha":"ae9e8a51bc29780d63c7f9efd6005d7c875e100b","analyzedAt":"2026-09-15T22:29:15.305Z","contentChangedAt":"2026-09-15T22:29:15.305Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}