{"record":{"id":"7bf7610871b470a4","repo":"BloopAI/vibe-kanban","slug":"failed-to-create-tracing-filter","errorCode":null,"errorMessage":"Failed to create tracing filter","messagePattern":"Failed to create tracing filter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/server/src/main.rs","lineNumber":46,"sourceCode":"    #[error(transparent)]\n    Other(#[from] AnyhowError),\n}\n\n#[tokio::main]\nasync fn main() -> Result<(), VibeKanbanError> {\n    // Install rustls crypto provider before any TLS operations\n    rustls::crypto::aws_lc_rs::default_provider()\n        .install_default()\n        .expect(\"Failed to install rustls crypto provider\");\n\n    sentry_utils::init_once(SentrySource::Backend);\n\n    let log_level = std::env::var(\"RUST_LOG\").unwrap_or_else(|_| \"info\".to_string());\n    let filter_string = format!(\n        \"warn,server={level},services={level},db={level},executors={level},deployment={level},local_deployment={level},utils={level},embedded_ssh={level},desktop_bridge={level},relay_hosts={level},relay_client={level},relay_webrtc={level},codex_core=off\",\n        level = log_level\n    );\n    let env_filter = EnvFilter::try_new(filter_string).expect(\"Failed to create tracing filter\");\n    tracing_subscriber::registry()\n        .with(tracing_subscriber::fmt::layer().with_filter(env_filter))\n        .with(sentry_layer())\n        .init();\n\n    // Create asset directory if it doesn't exist\n    if !asset_dir().exists() {\n        std::fs::create_dir_all(asset_dir())?;\n    }\n\n    // Copy old database to new location for safe downgrades\n    let old_db = asset_dir().join(\"db.sqlite\");\n    let new_db = asset_dir().join(\"db.v2.sqlite\");\n    if !new_db.exists() && old_db.exists() {\n        tracing::info!(\n            \"Copying database to new location: {:?} -> {:?}\",\n            old_db,\n            new_db","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/server/src/main.rs#L28-L64","documentation":"tracing_subscriber's EnvFilter::try_new returns a Result; it errors when the filter directive string is not valid RUST_LOG syntax. The server's main builds the filter from RUST_LOG and unwraps with expect(\"Failed to create tracing filter\"), so a malformed RUST_LOG value crashes startup.","triggerScenarios":"`main` reads RUST_LOG and interpolates it into `warn,server={level},...`; if RUST_LOG contains invalid directives (e.g. \"info,,=bad\", stray quotes, or empty/malformed level names), try_new returns Err and the expect panics.","commonSituations":"Users exporting RUST_LOG with typos (\"RUST_LOG=info,\" or \"RUST_LOG=trase\"), whitespace/quote artifacts from .env files, or level names that aren't valid (trace/debug/info/warn/error).","solutions":["Validate RUST_LOG early and fall back to the default \"info\" filter when try_new fails, logging a warning","Fix the RUST_LOG environment variable to contain valid comma-separated directives with valid level names","Trim/strip quotes from the env value before building filter_string","Support per-module levels only via valid directive syntax (e.g. server=debug)"],"exampleFix":"// before\nlet env_filter = EnvFilter::try_new(filter_string).expect(\"Failed to create tracing filter\");\n// after\nlet env_filter = EnvFilter::try_new(&filter_string).unwrap_or_else(|e| {\n    eprintln!(\"Invalid RUST_LOG ({e}); using default\");\n    EnvFilter::new(\"warn,server=info\")\n});","handlingStrategy":"fallback","validationCode":"fn valid_filter(s: &str) -> bool { tracing_subscriber::EnvFilter::try_new(s).is_ok() }","typeGuard":null,"tryCatchPattern":"let env_filter = EnvFilter::try_new(filter_string).unwrap_or_else(|e| {\n    eprintln!(\"Invalid RUST_LOG ({e}); falling back to default\");\n    EnvFilter::new(\"warn,server=info\")\n});","preventionTips":["Never trust RUST_LOG content: always fall back to a safe default filter","Trim quotes/whitespace from env values sourced from .env files","Document valid level names in the README for operators","Validate RUST_LOG at startup with a warning rather than a crash"],"tags":["rust","panic","tracing","logging","configuration"],"backgroundTag":"invalid-env-filter","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}