Hmbown/CodeWhale · error

continual harness state

Error message

continual harness state {} uses newer schema {}; this Codewhale supports schema {}

What it means

load_state refuses to deserialize a continual-harness state file whose schema_version is higher than the SCHEMA_VERSION this build understands. The state was written by a newer Codewhale and this binary cannot interpret it safely, so it fails closed rather than guessing at unknown fields.

Solutions

  1. Upgrade Codewhale to a build whose SCHEMA_VERSION is >= the version in the state file
  2. Delete or rename the state file at the reported path to let a new one be created (loses harness entries)
  3. Check state.schema_version in the file and migrate it manually only if you know the schema difference

Example fix

// before: reading state with an old binary
overview(...)
// after: upgrade or clear state
mv ~/.local/state/codewhale/continual_harness.json ~/.local/state/codewhale/continual_harness.json.bak
Defensive patterns

Strategy: validation

Validate before calling

let v: serde_json::Value = serde_json::from_str(&raw)?;
let sv = v.get("schema_version").and_then(|x| x.as_u64()).unwrap_or(0);
if sv > SUPPORTED_SCHEMA_VERSION { /* upgrade binary or discard state */ }

Prevention

When it happens

Trigger: Calling overview, refine, or remove while the state file at the given path was last written by a newer Codewhale version (schema_version > SCHEMA_VERSION).

Common situations: Downgrading the Codewhale binary (e.g. pinning an older release after running a newer one), switching between channels where the state file is shared, or restoring a state file from a newer machine.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/7084958dd2897f9a. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/continual_harness.rs:259

        Ok(raw) => raw,
        Err(error) if error.kind() == ErrorKind::NotFound => {
            return Ok(HarnessState {
                schema_version: SCHEMA_VERSION,
                entries: Vec::new(),
            });
        }
        Err(error) => {
            return Err(error)
                .with_context(|| format!("read continual harness state {}", path.display()));
        }
    };
    let mut state: HarnessState = serde_json::from_str(&raw)
        .with_context(|| format!("parse continual harness state {}", path.display()))?;
    if state.schema_version == 0 {
        state.schema_version = SCHEMA_VERSION;
    }
    if state.schema_version > SCHEMA_VERSION {
        bail!(
            "continual harness state {} uses newer schema {}; this Codewhale supports schema {}",
            path.display(),
            state.schema_version,
            SCHEMA_VERSION
        );
    }
    if state.entries.len() > MAX_ENTRIES {
        bail!(
            "continual harness state {} has {} entries; maximum is {MAX_ENTRIES}",
            path.display(),
            state.entries.len()
        );
    }
    Ok(state)
}

fn save_state(path: &Path, state: &HarnessState) -> Result<()> {
    let parent = path

View on GitHub (pinned to 73e0f67d83)