zeroclaw-labs/zeroclaw · error
setting default subscriber failed
Error message
setting default subscriber failed
What it means
Error "setting default subscriber failed" thrown in zeroclaw-labs/zeroclaw.
Source
Thrown at crates/zeroclaw-log/src/subscriber.rs:54
None => {
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(default_filter))
}
}
} else {
EnvFilter::new("off")
};
let fmt_layer = fmt::layer()
.fmt_fields(RedactEphemeralFields)
.with_writer(std::io::stderr)
.event_format(AgentAliasFormatter::new())
.with_filter(fmt_filter);
let subscriber = tracing_subscriber::registry()
.with(LogCaptureLayer.with_filter(recording_filter))
.with(fmt_layer);
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
}
#[doc(hidden)]
pub fn try_install_capture_subscriber() {
use tracing_subscriber::Registry;
let subscriber = Registry::default().with(LogCaptureLayer);
let _ = tracing::subscriber::set_global_default(subscriber);
}
/// Test support: install a process-global subscriber that hands every
/// formatted event line to `sink`, exactly where the stderr fmt layer would
/// write. Lets an integration test in another crate observe, and deliberately
/// stall, the terminal write path without naming `tracing` types outside this
/// crate. The sink runs unlocked on whichever thread emits the event, so a
/// sink that blocks on one event models a wedged consumer of that event
/// without serializing every other thread's unrelated writes behind it.
/// Mirrors the production wiring by stacking [`LogCaptureLayer`] under the
/// terminal layer, so `attribution_span!` scopes carry their attributionView on GitHub (pinned to 88bb9c8533)
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.
When it happens
Trigger: Thrown at crates/zeroclaw-log/src/subscriber.rs:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/4eecc505a6882b80.
Report an issue: GitHub.