{"record":{"id":"fd54bc5fa8fddb90","repo":"Hmbown/CodeWhale","slug":"automation-run-schema-v-is-newer-than-supported","errorCode":null,"errorMessage":"Automation run schema v{} is newer than supported v{}","messagePattern":"Automation run schema v(.+?) is newer than supported v(.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":2765,"sourceCode":"    let record: AutomationRecord = serde_json::from_str(&raw)\n        .with_context(|| format!(\"Failed to parse automation {}\", path.display()))?;\n    if record.schema_version > CURRENT_AUTOMATION_SCHEMA_VERSION {\n        bail!(\n            \"Automation schema v{} is newer than supported v{}\",\n            record.schema_version,\n            CURRENT_AUTOMATION_SCHEMA_VERSION\n        );\n    }\n    Ok(record)\n}\n\nfn read_run_file(path: &Path) -> Result<AutomationRunRecord> {\n    let raw =\n        fs::read_to_string(path).with_context(|| format!(\"Failed to read {}\", path.display()))?;\n    let run: AutomationRunRecord = serde_json::from_str(&raw)\n        .with_context(|| format!(\"Failed to parse {}\", path.display()))?;\n    if run.schema_version > CURRENT_RUN_SCHEMA_VERSION {\n        bail!(\n            \"Automation run schema v{} is newer than supported v{}\",\n            run.schema_version,\n            CURRENT_RUN_SCHEMA_VERSION\n        );\n    }\n    Ok(run)\n}\n\nfn ensure_safe_storage_id(kind: &str, value: &str) -> Result<()> {\n    let mut components = Path::new(value).components();\n    let Some(component) = components.next() else {\n        bail!(\"{kind} must not be empty\");\n    };\n    if components.next().is_some() || !matches!(component, std::path::Component::Normal(_)) {\n        bail!(\"{kind} must be a single path component\");\n    }\n    Ok(())\n}","sourceCodeStart":2747,"sourceCodeEnd":2783,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L2747-L2783","documentation":"read_run_file is the run-history counterpart of the automation schema guard: an AutomationRunRecord with schema_version above CURRENT_RUN_SCHEMA_VERSION is rejected rather than parsed, because an older binary cannot safely interpret a newer run file format.","triggerScenarios":"Loading a persisted automation run file written by a newer Codewhale build into an older binary.","commonSituations":"Downgrading the app while keeping run history; copying run logs from a machine on a newer release; switching branches where the run schema was bumped.","solutions":["Upgrade Codewhale to a build supporting the run schema version in the file.","Discard or archive the too-new run files if staying on the old version is intentional.","Keep separate data directories per app version to avoid mixing run histories across schema bumps."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let run: AutomationRunRecord = serde_json::from_str(&raw)?;\nif run.schema_version > CURRENT_RUN_SCHEMA_VERSION {\n    // archive instead of loading\n}","typeGuard":"fn supported_run(raw: &str) -> Option<AutomationRunRecord> {\n    let run: AutomationRunRecord = serde_json::from_str(raw).ok()?;\n    (run.schema_version <= CURRENT_RUN_SCHEMA_VERSION).then_some(run)\n}","tryCatchPattern":"match read_run_file(&path) {\n    Ok(r) => display(r),\n    Err(e) if e.to_string().contains(\"newer than supported\") => archive(&path),\n    Err(e) => return Err(e),\n}","preventionTips":["Use separate data directories per app version so run histories never mix schemas.","Before downgrading, export or archive run history.","Validate schema_version on any imported run log before parsing it into app state."],"tags":["automation","schema","versioning"],"backgroundTag":"schema-validation-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}