{"record":{"id":"4eecc505a6882b80","repo":"zeroclaw-labs/zeroclaw","slug":"setting-default-subscriber-failed","errorCode":null,"errorMessage":"setting default subscriber failed","messagePattern":"setting default subscriber failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-log/src/subscriber.rs","lineNumber":54,"sourceCode":"            None => {\n                EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(default_filter))\n            }\n        }\n    } else {\n        EnvFilter::new(\"off\")\n    };\n\n    let fmt_layer = fmt::layer()\n        .fmt_fields(RedactEphemeralFields)\n        .with_writer(std::io::stderr)\n        .event_format(AgentAliasFormatter::new())\n        .with_filter(fmt_filter);\n\n    let subscriber = tracing_subscriber::registry()\n        .with(LogCaptureLayer.with_filter(recording_filter))\n        .with(fmt_layer);\n\n    tracing::subscriber::set_global_default(subscriber).expect(\"setting default subscriber failed\");\n}\n\n#[doc(hidden)]\npub fn try_install_capture_subscriber() {\n    use tracing_subscriber::Registry;\n    let subscriber = Registry::default().with(LogCaptureLayer);\n    let _ = tracing::subscriber::set_global_default(subscriber);\n}\n\n/// Test support: install a process-global subscriber that hands every\n/// formatted event line to `sink`, exactly where the stderr fmt layer would\n/// write. Lets an integration test in another crate observe, and deliberately\n/// stall, the terminal write path without naming `tracing` types outside this\n/// crate. The sink runs unlocked on whichever thread emits the event, so a\n/// sink that blocks on one event models a wedged consumer of that event\n/// without serializing every other thread's unrelated writes behind it.\n/// Mirrors the production wiring by stacking [`LogCaptureLayer`] under the\n/// terminal layer, so `attribution_span!` scopes carry their attribution","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-log/src/subscriber.rs#L36-L72","documentation":"Error \"setting default subscriber failed\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-log/src/subscriber.rs:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure no other global tracing subscriber is set before zeroclaw-log initializes; initialize logging only once.","Check for conflicting logging setup in embedded usage and remove duplicate subscriber initialization."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}