dani-garcia/vaultwarden · error

Failed to parse overrides

Error message

Failed to parse overrides

What it means

The per-module overrides portion of LOG_LEVEL (comma-separated log=level pairs) is parsed with LevelFilter::from_str per pair; pairs that fail are silently dropped by filter_map, and if none survive (or the captures section fails) this error is returned.

Solutions

  1. Use only valid Rust log levels in overrides: off/error/warn/info/debug/trace
  2. Ensure each override is module=level, e.g. vaultwarden::api::icons=debug
  3. Remove empty segments/trailing commas from LOG_LEVEL
  4. Fall back to a plain global level like LOG_LEVEL=info to isolate the bad token

Example fix

// before
LOG_LEVEL=info,vaultwarden::api::icons=warning
// after
LOG_LEVEL=info,vaultwarden::api::icons=warn
Defensive patterns

Strategy: validation

Validate before calling

const VALID = ['off','error','warn','info','debug','trace'];
for (const part of (process.env.LOG_LEVEL ?? '').split(',').slice(1)) {
  const [mod, lvl] = part.split('=');
  if (!mod || !VALID.includes((lvl ?? '').trim().toLowerCase())) throw new Error(`Bad LOG_LEVEL override: "${part}"`);
}

Type guard

function parseOverride(part) { const i = part.lastIndexOf('='); const mod = part.slice(0, i); const lvl = part.slice(i + 1); return i > 0 && ['off','error','warn','info','debug','trace'].includes(lvl) ? [mod, lvl] : null; }

Prevention

When it happens

Trigger: LOG_LEVEL matches the level regex but contains invalid level tokens in the override list, e.g. LOG_LEVEL='info,vaultwarden::api::icons=verbose' or LOG_LEVEL='info,foo='.

Common situations: Using levels from other logging libraries ('warning', 'fatal'); trailing commas producing empty tokens; forgetting the '=' in a pair; copying LOG_LEVEL syntax from tracing/env_logger which differs.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of dani-garcia/vaultwarden@cc67d644f6 (2026-09-19). Data as JSON: /api/errors/eaee2604fddb3031. Report an issue: GitHub.

Appendix: source

Thrown at src/main.rs:261

        let level = caps
            .get(1)
            .and_then(|m| log::LevelFilter::from_str(m.as_str()).ok())
            .ok_or(Error::new("Failed to parse global log level".to_owned(), ""))?;

        let levels_override: Vec<(&str, log::LevelFilter)> = caps
            .get(2)
            .map(|m| {
                m.as_str()
                    .split(',')
                    .collect::<Vec<&str>>()
                    .into_iter()
                    .filter_map(|s| match s.split_once('=') {
                        Some((log, lvl_str)) => log::LevelFilter::from_str(lvl_str).ok().map(|lvl| (log, lvl)),
                        _ => None,
                    })
                    .collect()
            })
            .ok_or(Error::new("Failed to parse overrides".to_owned(), ""))?;

        (level, levels_override)
    } else {
        err!(format!("LOG_LEVEL should follow the format info,vaultwarden::api::icons=debug, invalid: {config_str}"))
    };

    // Depending on the main log level we either want to disable or enable logging for hickory.
    // Else if there are timeouts it will clutter the logs since hickory uses warn for this.
    let hickory_level = if level >= log::LevelFilter::Debug {
        level
    } else {
        log::LevelFilter::Off
    };

    // Only show Rocket underscore `_` logs when the level is Debug or higher
    // Else this will bloat the log output with useless messages.
    let rocket_underscore_level = if level >= log::LevelFilter::Debug {
        log::LevelFilter::Warn

View on GitHub (pinned to cc67d644f6)