symfony/translation · error · IncompleteDsnException
Password is not set.
Error message
Password is not set.
What it means
AbstractProviderFactory::getPassword extracts the password from a translation-provider DSN and throws IncompleteDsnException when it is absent. Providers whose authentication scheme requires both a user and a password (or key/secret pair) cannot be constructed without it.
Solutions
- Append the password/secret to the DSN: 'scheme://user:SECRET@host'.
- Check that the env var holding the secret is actually set and non-empty at runtime.
- URL-encode special characters in the secret before embedding it in the DSN.
- If the provider uses key-only auth, confirm the scheme matches a factory that doesn't call getPassword.
Example fix
// before
new Dsn('crowdin://user@organization.crowdin.com');
// after
new Dsn('crowdin://user:SECRET@organization.crowdin.com'); Defensive patterns
Strategy: validation
Validate before calling
$params = parse_url($dsn);
if (!isset($params['pass']) || '' === $params['pass']) {
throw new \InvalidArgumentException('DSN must include a password/secret');
} Try / catch
try {
$provider = $factory->createProvider(new Dsn($dsn));
} catch (IncompleteDsnException $e) {
// surface which credential part is missing
} Prevention
- Assert the secret env var exists and is non-empty during bootstrap.
- rawurlencode secrets so special characters survive parse_url.
- Use the scheme://user:secret@host template consistently in docs and CI checks.
When it happens
Trigger: Creating a provider from a DSN containing a user but no password component, e.g. 'scheme://user@host', for schemes whose getSupportedSchemes() require a secret.
Common situations: DSN assembled with only the API-key-as-user, dropping the secret during config templating, secret injected as empty string being dropped, or docs example copied without the secret part.
Related errors
- User is not set.
- The translation provider DSN is invalid.
- The translation provider DSN must contain a scheme.
- The translation provider DSN must contain a host (use…
- Missing required option
AI-assisted analysis of symfony/translation@ae9e8a51bc (2026-09-15).
Data as JSON: /api/errors/6720b91f5355a487.
Report an issue: GitHub.
Appendix: source
Thrown at Provider/AbstractProviderFactory.php:35
{
public function supports(Dsn $dsn): bool
{
return \in_array($dsn->getScheme(), $this->getSupportedSchemes(), true);
}
/**
* @return string[]
*/
abstract protected function getSupportedSchemes(): array;
protected function getUser(Dsn $dsn): string
{
return $dsn->getUser() ?? throw new IncompleteDsnException('User is not set.', $dsn->getScheme().'://'.$dsn->getHost());
}
protected function getPassword(Dsn $dsn): string
{
return $dsn->getPassword() ?? throw new IncompleteDsnException('Password is not set.', $dsn->getOriginalDsn());
}
}
View on GitHub (pinned to ae9e8a51bc)