linera-io/linera-protocol · error

test-log: RUST_LOG_SPAN_EVENTS must contain filters separate

Error message

test-log: RUST_LOG_SPAN_EVENTS must contain filters separated by `,`.\n\tFor example: `active` or `new,close`\n\tSupported filters: new, enter, exit, close, active, full\n\tGot: {value}

What it means

The storage-service server binary parses RUST_LOG_SPAN_EVENTS to configure tracing span events, splitting on commas and mapping each token to a FmtSpan flag. Recognized filters are new, enter, exit, close, active, full; any other token panics in main during logger initialization, aborting server startup.

Source

Thrown at linera-storage-service/src/server.rs:621

        .with_default_directive(tracing_subscriber::filter::LevelFilter::INFO.into())
        .from_env_lossy();
    let internal_event_filter = {
        match std::env::var_os("RUST_LOG_SPAN_EVENTS") {
            Some(mut value) => {
                value.make_ascii_lowercase();
                let value = value
                    .to_str()
                    .expect("test-log: RUST_LOG_SPAN_EVENTS must be valid UTF-8");
                value
                    .split(',')
                    .map(|filter| match filter.trim() {
                        "new" => FmtSpan::NEW,
                        "enter" => FmtSpan::ENTER,
                        "exit" => FmtSpan::EXIT,
                        "close" => FmtSpan::CLOSE,
                        "active" => FmtSpan::ACTIVE,
                        "full" => FmtSpan::FULL,
                        _ => panic!("test-log: RUST_LOG_SPAN_EVENTS must contain filters separated by `,`.\n\t\
                                     For example: `active` or `new,close`\n\t\
                                     Supported filters: new, enter, exit, close, active, full\n\t\
                                     Got: {value}"),
                    })
                    .fold(FmtSpan::NONE, |acc, filter| filter | acc)
            }
            None => FmtSpan::NONE,
        }
    };
    tracing_subscriber::fmt()
        .with_span_events(internal_event_filter)
        .with_writer(std::io::stderr)
        .with_env_filter(env_filter)
        .init();

    let options = <StorageServerOptions as clap::Parser>::parse();
    let (store, endpoint) = match options {
        StorageServerOptions::Memory {

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use only the supported filters: new, enter, exit, close, active, full (comma-separated)
  2. Remove trailing/double commas that create empty tokens
  3. Unset the variable when you don't need span events

Example fix

# before
export RUST_LOG_SPAN_EVENTS="new,enter,spawn"

# after
export RUST_LOG_SPAN_EVENTS="new,enter"
Defensive patterns

Strategy: validation

Validate before calling

const SPAN_FILTERS: [&str; 6] = ["new", "enter", "exit", "close", "active", "full"];
if let Ok(value) = std::env::var("RUST_LOG_SPAN_EVENTS") {
    for token in value.split(',') {
        assert!(SPAN_FILTERS.contains(&token), "bad RUST_LOG_SPAN_EVENTS token: {token}");
    }
}

Prevention

When it happens

Trigger: Starting linera-storage-service with RUST_LOG_SPAN_EVENTS containing an unknown filter — e.g. 'enter,exit,spawn', 'NEW', 'none', or an empty token from a trailing comma.

Common situations: Copy-pasting RUST_LOG_SPAN_EVENTS values used with other Rust projects (test-log's set accepts a similar list but people add others); scripts sharing one env block across services; typo'd filter names.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/f5a56b55acf66cf9. Report an issue: GitHub.