Hmbown/CodeWhale · error · anyhow::Error
Invalid coordination ledger: {error}
Error message
Invalid coordination ledger: {error} What it means
Integrity guard after loading sub-agent state: the persisted coordination ledger failed validate_replay(), meaning the recorded coordination events cannot be consistently replayed (gaps, out-of-order entries, or corrupted history). The state file passed schema and JSON checks but its event ledger is not internally consistent.
Source
Thrown at crates/tui/src/tools/subagent/mod.rs:4343
legacy
} else {
return Ok(());
}
};
let raw = read_subagent_state_file(&self.state_root, &path)?;
let state = serde_json::from_str::<PersistedSubAgentState>(&raw)?;
if state.schema_version != SUBAGENT_STATE_SCHEMA_VERSION {
return Err(anyhow!(
"Unsupported sub-agent state schema {}",
state.schema_version
));
}
let mut coordination = state.coordination;
coordination
.validate_replay()
.map_err(|error| anyhow!("Invalid coordination ledger: {error}"))?;
self.agents.clear();
self.worker_records.clear();
self.persist_sequence.store(
state.snapshot_sequence,
std::sync::atomic::Ordering::Relaxed,
);
self.coordination = coordination;
for persisted in state.agents {
let nickname = persisted
.nickname
.filter(|name| generated_whale_name_base(&persisted.id, name).is_none());
let mut status = persisted.status;
if matches!(status, SubAgentStatus::Running) {
status = SubAgentStatus::Interrupted(SUBAGENT_RESTART_REASON.to_string());
}
let started_at = instant_from_duration(Duration::from_millis(persisted.duration_ms));
// Empty vec on disk → None (full inheritance, v0.6.6 default).View on GitHub (pinned to 0c42157ee5)
Solutions
- Delete the persisted sub-agent state file and let coordination rebuild from scratch
- Check the inner {error} for which replay invariant failed
- Avoid killing the process mid-coordination-write, which truncates the ledger
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/tools/subagent/mod.rs:4343 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/9a6619194e92bba5.
Report an issue: GitHub.