Hmbown/CodeWhale · error · anyhow::Error

Unsupported sub-agent state schema {}

Error message

Unsupported sub-agent state schema {}

What it means

Schema guard while loading persisted sub-agent state: the JSON deserialized successfully but state.schema_version does not equal SUBAGENT_STATE_SCHEMA_VERSION. The file (from the current path or the legacy migration path) was written by an incompatible older/newer version, and no migration path exists for it.

Source

Thrown at crates/tui/src/tools/subagent/mod.rs:4334

                    .join("state")
                    .join(SUBAGENT_STATE_FILE),
            )?;
            if legacy.exists() {
                tracing::info!(
                    target: "subagent",
                    "loading sub-agent state from legacy path for migration: {}",
                    legacy.display()
                );
                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

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Regenerate the sub-agent state by deleting the persisted state file — agent coordination state is reconstructible
  2. Use the Codewhale version that wrote the file to migrate or consume it
  3. Do not hand-edit schema_version; the format difference is semantic, not just numeric
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/tools/subagent/mod.rs:4334 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/3beaacff793eb7e6. Report an issue: GitHub.