Hmbown/CodeWhale · error · anyhow::Error

Automation run schema v{} is newer than supported v{}

Error message

Automation run schema v{} is newer than supported v{}

What it means

read_run_file parses an automation run history record and rejects any AutomationRunRecord whose schema_version exceeds CURRENT_RUN_SCHEMA_VERSION (v1 in this build). Run records persist under the automations storage tree carrying the version stamp of the binary that wrote them; the guard prevents an older codewhale from misinterpreting runs saved by a newer release. The message lists the file's version versus the supported one.

Source

Thrown at crates/tui/src/automation_manager.rs:1822

        return false;
    };
    if !rest.starts_with('-') || rest.len() < 2 {
        return false;
    }
    stamp.char_indices().all(|(idx, ch)| match idx {
        8 => ch == 'T',
        18 => ch == 'Z',
        _ => ch.is_ascii_digit(),
    })
}

fn read_run_file(path: &Path) -> Result<AutomationRunRecord> {
    let raw =
        fs::read_to_string(path).with_context(|| format!("Failed to read {}", path.display()))?;
    let run: AutomationRunRecord = serde_json::from_str(&raw)
        .with_context(|| format!("Failed to parse {}", path.display()))?;
    if run.schema_version > CURRENT_RUN_SCHEMA_VERSION {
        bail!(
            "Automation run schema v{} is newer than supported v{}",
            run.schema_version,
            CURRENT_RUN_SCHEMA_VERSION
        );
    }
    Ok(run)
}

fn ensure_safe_storage_id(kind: &str, value: &str) -> Result<()> {
    let mut components = Path::new(value).components();
    let Some(component) = components.next() else {
        bail!("{kind} must not be empty");
    };
    if components.next().is_some() || !matches!(component, std::path::Component::Normal(_)) {
        bail!("{kind} must be a single path component");
    }
    Ok(())
}

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Upgrade codewhale to a build whose run schema supports the version named in the message.
  2. Otherwise archive or delete the newer-schema run JSON files under the automations runs storage to unblock history loading.
  3. Isolate state directories per version so old binaries never open new records.
Defensive patterns

Strategy: try-catch

Validate before calling

fn record_schema_supported(path: &std::path::Path, supported: u64) -> bool {
    std::fs::read(path)
        .ok()
        .and_then(|raw| serde_json::from_slice::<serde_json::Value>(&raw).ok())
        .map(|v| v["schema_version"].as_u64().unwrap_or(0) <= supported)
        .unwrap_or(false)
}

Try / catch

Catch the load error, branch on "newer than supported", and degrade gracefully — skip that run in history views while logging which file requires a newer binary; rethrow unrelated parse or IO errors.

Prevention

When it happens

Trigger: Any flow that loads run history — listing runs, loading a run by id, resume or detail views backed by read_run_file — hitting a JSON file whose schema_version is greater than the compiled constant.

Common situations: Reading run history after downgrading codewhale; a synced or copied ~/.codewhale directory produced by a newer version; mixed-version installs (CI, teammate machines) sharing one state directory.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/fd54bc5fa8fddb90. Report an issue: GitHub.