nautechsystems/nautilus_trader · critical
Redis config error: username supplied without password. Eith
Error message
Redis config error: username supplied without password. Either supply a password or omit the username.
What it means
`get_redis_url` in crates/infrastructure/src/redis/mod.rs validates the credential configuration and panics when a username is provided without a password. A Redis URL with credentials requires both parts (or neither); the partial combination would produce a malformed/ambiguous URL, so the function treats it as a hard configuration error. This is a user-facing config mistake surfaced as a panic at connection-setup time.
Source
Thrown at crates/infrastructure/src/redis/mod.rs:132
} else {
pw.to_owned()
}
};
// Build the `userinfo@` portion for both the real and redacted URLs.
let (auth, auth_redacted) = match (username.is_empty(), password.is_empty()) {
// user:pass@
(false, false) => (
format!("{username}:{password}@"),
format!("{username}:{}@", redact_pw(password)),
),
// :pass@
(true, false) => (
format!(":{password}@"),
format!(":{}@", redact_pw(password)),
),
// username but no password ⇒ configuration error
(false, true) => panic!(
"Redis config error: username supplied without password. \
Either supply a password or omit the username."
),
// no credentials
(true, true) => (String::new(), String::new()),
};
let scheme = if ssl { "rediss" } else { "redis" };
let url = format!("{scheme}://{auth}{host}:{port}");
let redacted_url = format!("{scheme}://{auth_redacted}{host}:{port}");
(url, redacted_url)
}
/// Creates a new Redis connection manager based on the provided database `config` and connection name.
///
/// # ErrorsView on GitHub (pinned to 18893faf8b)
Solutions
- Supply the password alongside the username in the Redis config (check the relevant env var, e.g. REDIS_PASSWORD, is actually set).
- Remove the username if the Redis instance does not use authentication (omit both).
- Validate the config before startup: assert password.is_some() whenever username is set.
Example fix
// before
RedisConfig { username: Some("default".into()), password: None, .. } // panics
// after
RedisConfig { username: Some("default".into()), password: Some("secret".into()), .. }
// or username: None, password: None Defensive patterns
Strategy: validation
Validate before calling
// before building the config
if config.username.is_some() && config.password.as_deref().map_or(true, str::is_empty) {
return Err("password required when username is set");
} Try / catch
// validate config at startup and fail fast with a clear message:
validate_redis_config(&cfg).expect("invalid Redis credentials: username requires password"); Prevention
- Set both REDIS username and password env vars together, or neither.
- Check env var spelling and container secret mounting when credentials look partial.
- Run a config preflight check before the node connects to Redis.
When it happens
Trigger: Building a RedisConfig with `username` set but `password` None/empty, then calling `get_redis_url` (directly or via `create_redis_connection`). The match arm `(false, true)` (no password, username present) triggers the panic.
Common situations: Redis Cloud/MemoryDB setups where only a username is copied from the console; partially redacted configs where the password env var is unset but the username is set; mistyping the password env variable name.
Related errors
- Unsupported blockchain {blockchain} for RPC connection
- Kraken Spot does not support the demo environment
- Close command should not be drained
- Flush command should not be drained
- {secret_var} is required when {key_var} is provided
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/ac1e0fac3f263f6e.
Report an issue: GitHub.