BloopAI/vibe-kanban · error
Failed to create tracing filter
Error message
Failed to create tracing filter
What it means
`tracing_subscriber::EnvFilter::try_new(filter_string)` returns Err when the filter directive string is not valid tracing filter syntax; the `.expect()` turns that into a panic at startup. Invalid syntax includes malformed directives, unknown level names (e.g. RUST_LOG set to "verbose"), stray commas/brackets, or invalid target=level pairs like "server=".
Source
Thrown at crates/tauri-app/src/main.rs:123
.show()
{
tracing::warn!("Failed to send Tauri notification: {}", e);
}
}
}
fn main() {
// Install rustls crypto provider before any TLS operations
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.expect("Failed to install rustls crypto provider");
let log_level = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string());
let filter_string = format!(
"warn,server={level},services={level},db={level},executors={level},deployment={level},local_deployment={level},utils={level},vibe_kanban_tauri={level}",
level = log_level
);
let env_filter = EnvFilter::try_new(filter_string).expect("Failed to create tracing filter");
sentry_utils::init_once(SentrySource::Desktop);
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer().with_filter(env_filter))
.with(sentry_layer())
.init();
// Shared token so we can tell the server to shut down when the app quits.
let shutdown_token = Arc::new(CancellationToken::new());
let shutdown_token_for_event = shutdown_token.clone();
// Holds downloaded update bytes until the app exits or user restarts.
// Created here (outside setup) so the RunEvent::Exit handler can access it.
let pending_update: Arc<Mutex<Option<Vec<u8>>>> = Arc::new(Mutex::new(None));
let pending_for_setup = pending_update.clone();
let pending_for_exit = pending_update.clone();
View on GitHub (pinned to 4deb7eca8f)
Solutions
- Sanitize the RUST_LOG value before interpolation: only accept known levels (trace|debug|info|warn|error), else fall back to "info".
- Replace expect with fallback: `EnvFilter::try_new(filter_string).unwrap_or_else(|_| EnvFilter::new("warn"))` and log the parse failure.
- Validate RUST_LOG at startup and print a clear message about the accepted format.
- Test the filter with `RUST_LOG='warn,server=debug'` to confirm the accepted syntax.
Example fix
// before
let log_level = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string());
let env_filter = EnvFilter::try_new(filter_string).expect("Failed to create tracing filter");
// after
let log_level = match std::env::var("RUST_LOG").as_deref() {
Ok("trace") | Ok("debug") | Ok("info") | Ok("warn") | Ok("error") => std::env::var("RUST_LOG").unwrap(),
_ => "info".to_string(),
};
let env_filter = EnvFilter::try_new(filter_string)
.unwrap_or_else(|_| EnvFilter::new("warn")); Defensive patterns
Strategy: validation
Validate before calling
// Only accept known level names from RUST_LOG
const LEVELS: [&str; 5] = ["trace", "debug", "info", "warn", "error"];
let level = std::env::var("RUST_LOG").ok().filter(|v| LEVELS.contains(&v.as_str())).unwrap_or_else(|| "info".into()); Type guard
fn is_valid_log_level(s: &str) -> bool {
matches!(s, "trace" | "debug" | "info" | "warn" | "error")
} Try / catch
// Fall back instead of panicking:
let env_filter = EnvFilter::try_new(filter_string)
.unwrap_or_else(|e| {
eprintln!("Invalid RUST_LOG filter ({e}); using default");
EnvFilter::new("warn,server=info");
}); Prevention
- Never interpolate raw RUST_LOG into filter strings without whitelisting.
- Document the accepted RUST_LOG format in the app README.
- Prefer EnvFilter::from_default_env() plus targeted directives over string formatting.
- Add a startup smoke test that builds the filter for each accepted level.
When it happens
Trigger: Running the Tauri app with `RUST_LOG` set to a value that produces an invalid combined filter, e.g. RUST_LOG="trace," (trailing comma producing an empty directive is tolerated, but RUST_LOG="server=" or "=info" or "foo::bar=bogus" fails), which gets interpolated into "warn,server={level},...".
Common situations: Users exporting RUST_LOG with IDE-style values ("debugger", "5"), typos like RUST_LOG=info,extra=, or level strings copied from other frameworks; shell profiles that set a malformed global RUST_LOG.
Related errors
- Failed to create tracing filter
- validated digest hour
- error while building tauri application
- This host is not paired with your browser. Pair it in Relay
- No setup script configured for this project
AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29).
Data as JSON: /api/errors/598d16f4263d9ac0.
Report an issue: GitHub.