{"record":{"id":"2a7551c5ab0ec5bf","repo":"symfony/translation","slug":"user-is-not-set","errorCode":null,"errorMessage":"User is not set.","messagePattern":"User is not set\\.","errorType":"exception","errorClass":"IncompleteDsnException","httpStatus":null,"severity":"error","filePath":"Provider/AbstractProviderFactory.php","lineNumber":30,"sourceCode":"namespace Symfony\\Component\\Translation\\Provider;\n\nuse Symfony\\Component\\Translation\\Exception\\IncompleteDsnException;\n\nabstract class AbstractProviderFactory implements ProviderFactoryInterface\n{\n    public function supports(Dsn $dsn): bool\n    {\n        return \\in_array($dsn->getScheme(), $this->getSupportedSchemes(), true);\n    }\n\n    /**\n     * @return string[]\n     */\n    abstract protected function getSupportedSchemes(): array;\n\n    protected function getUser(Dsn $dsn): string\n    {\n        return $dsn->getUser() ?? throw new IncompleteDsnException('User is not set.', $dsn->getScheme().'://'.$dsn->getHost());\n    }\n\n    protected function getPassword(Dsn $dsn): string\n    {\n        return $dsn->getPassword() ?? throw new IncompleteDsnException('Password is not set.', $dsn->getOriginalDsn());\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":38,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Provider/AbstractProviderFactory.php#L12-L38","documentation":"AbstractProviderFactory::getUser extracts the username from a translation-provider DSN (e.g. a LOCO or translation vendor DSN). If the DSN has no user component, an IncompleteDsnException is thrown, since the provider cannot authenticate without credentials embedded in the DSN.","triggerScenarios":"Creating a provider via a factory with a DSN lacking a user part, e.g. 'somescheme://host' or 'somescheme://:password@host', when the scheme requires a user (API key).","commonSituations":"Env var TRANSLATION_DSN set without credentials, copying a DSN example and deleting the user portion, YAML config with scheme and host only.","solutions":["Add the user (usually the API key) to the DSN: 'scheme://USER@host'.","Fix the environment variable or config file supplying the DSN so it includes the credentials.","If the provider genuinely needs no user, verify you are using the correct scheme/factory.","Validate the DSN with parse_url before passing it to the factory."],"exampleFix":"// before\n$provider = $factory->createProvider(new Dsn('loco://api.locoapp'));\n\n// after\n$provider = $factory->createProvider(new Dsn('loco://MY_API_KEY@api.locoapp'));","handlingStrategy":"validation","validationCode":"$params = parse_url($dsn);\nif (!isset($params['user']) || '' === $params['user']) {\n    throw new \\InvalidArgumentException('DSN must include a user (API key)');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $provider = $factory->createProvider(new Dsn($dsn));\n} catch (IncompleteDsnException $e) {\n    // report missing credentials config to the operator\n}","preventionTips":["Validate DSN shape (scheme, user, host) at config load time.","Keep credentials in env vars and assert they are non-empty before building the DSN.","Document the expected DSN format next to the config key."],"tags":["dsn","credentials","translation-provider","config"],"backgroundTag":"missing-credentials","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"}