{"record":{"id":"e4bf710183c5e56c","repo":"symfony/translation","slug":"missing-required-option-s","errorCode":null,"errorMessage":"Missing required option \"%s\".","messagePattern":"Missing required option \"(.+?)\"\\.","errorType":"exception","errorClass":"MissingRequiredOptionException","httpStatus":null,"severity":"error","filePath":"Provider/Dsn.php","lineNumber":90,"sourceCode":"    public function getPassword(): ?string\n    {\n        return $this->password;\n    }\n\n    public function getPort(?int $default = null): ?int\n    {\n        return $this->port ?? $default;\n    }\n\n    public function getOption(string $key, mixed $default = null): mixed\n    {\n        return $this->options[$key] ?? $default;\n    }\n\n    public function getRequiredOption(string $key): mixed\n    {\n        if (!\\array_key_exists($key, $this->options) || '' === trim($this->options[$key])) {\n            throw new MissingRequiredOptionException($key);\n        }\n\n        return $this->options[$key];\n    }\n\n    public function getOptions(): array\n    {\n        return $this->options;\n    }\n\n    public function getPath(): ?string\n    {\n        return $this->path;\n    }\n\n    public function getOriginalDsn(): string\n    {\n        return $this->originalDsn;","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Provider/Dsn.php#L72-L108","documentation":"Thrown by Dsn::getRequiredOption() when a mandatory DSN option (such as the API key in a translation provider DSN) is absent or present but blank. Symfony translation providers use this to fail fast with a clear message instead of an obscure authentication failure later.","triggerScenarios":"Calling getRequiredOption($key) on a Dsn object whose options array does not contain $key, or contains it with a value that trims to an empty string.","commonSituations":"Missing parts of a TRANSLATION_PROVIDER_DSN (e.g. 'acfred://default' without a key), empty environment variable interpolated into the DSN, or a DSN built programmatically with an options array lacking the required key.","solutions":["Add the required option to the DSN, e.g. acfred://API_KEY@default","Verify the environment variable used in the DSN is set and non-empty","Check .env / .env.local for typos in the provider DSN","If calling getRequiredOption yourself, pre-check with getOption($key) and handle absence"],"exampleFix":"// before\nTRANSLATION_PROVIDER_DSN=acfred://default\n// after\nTRANSLATION_PROVIDER_DSN=acfred://YOUR_API_KEY@default","handlingStrategy":"validation","validationCode":"if ('' === trim((string) $dsn->getOption('key', ''))) {\n    throw new \\RuntimeException('Provider DSN is missing the API key option.');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $key = $dsn->getRequiredOption('key');\n} catch (MissingRequiredOptionException $e) {\n    // surface a config hint to the user\n}","preventionTips":["Keep full provider DSNs (with key) in .env and verify with bin/console debug:container --env-vars","Prefer getOption() with a default when the option is optional","Validate DSNs at boot with a config health check"],"tags":["php","config","dsn","symfony"],"backgroundTag":"missing-required-option","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"}