{"record":{"id":"85f6d9ec88cc6869","repo":"Hmbown/CodeWhale","slug":"automation-schema-v-is-newer-than-supported-v","errorCode":null,"errorMessage":"Automation schema v{} is newer than supported v{}","messagePattern":"Automation schema v(.+?) is newer than supported v(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":996,"sourceCode":"            status,\n            created_at: now,\n            updated_at: now,\n            next_run_at,\n            last_run_at: None,\n        };\n\n        self.save_automation(&record)?;\n        Ok(record)\n    }\n\n    pub fn get_automation(&self, id: &str) -> Result<AutomationRecord> {\n        let path = self.automation_path(id)?;\n        let raw = fs::read_to_string(&path)\n            .with_context(|| format!(\"Failed to read automation {}\", path.display()))?;\n        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\n    pub fn save_automation(&self, record: &AutomationRecord) -> Result<()> {\n        write_json_atomic(&self.automation_path(&record.id)?, record)\n    }\n\n    pub fn list_automations(&self) -> Result<Vec<AutomationRecord>> {\n        let mut out = Vec::new();\n        for entry in fs::read_dir(&self.automations_dir)\n            .with_context(|| format!(\"Failed to read {}\", self.automations_dir.display()))?\n        {\n            let entry = entry?;","sourceCodeStart":978,"sourceCodeEnd":1014,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/automation_manager.rs#L978-L1014","documentation":"get_automation loads a single automation JSON and refuses records whose schema_version exceeds CURRENT_AUTOMATION_SCHEMA_VERSION (currently 1). The file was written by a newer Codewhale build whose record format this binary cannot interpret; the file is left on disk untouched.","triggerScenarios":"Creating automations with a newer Codewhale release, then downgrading the binary and calling get_automation or update_automation in the same workspace; also hand-edited records with a bumped schema_version.","commonSituations":"Release rollbacks; shared workspaces edited by machines running different versions; syncing the automations directory between installs.","solutions":["Upgrade the binary to at least the version that wrote the record","Inspect the JSON to confirm schema_version and decide whether the record is expendable","Delete or archive the offending record if it is not needed","Pin one version across machines sharing the automations directory"],"exampleFix":"// before: record written by a newer build\n{ \"schema_version\": 2, \"id\": \"auto_...\", \"rrule\": \"FREQ=HOURLY;INTERVAL=1\" }\n\n// after: reopen with the newer binary, or archive the file\n// (do not hand-lower schema_version unless the fields truly match v1)","handlingStrategy":"type-guard","validationCode":"fn automation_record_loadable(path: &std::path::Path) -> Result<bool, anyhow::Error> {\n    let raw = std::fs::read_to_string(path)?;\n    let probe: serde_json::Value = serde_json::from_str(&raw)?;\n    Ok(probe.get(\"schema_version\").and_then(|v| v.as_u64()).unwrap_or(1) <= 1)\n}","typeGuard":"fn is_supported_automation_json(raw: &str) -> bool {\n    serde_json::from_str::<serde_json::Value>(raw)\n        .ok()\n        .and_then(|v| v.get(\"schema_version\").and_then(|s| s.as_u64()))\n        .is_none_or(|v| v <= 1)\n}","tryCatchPattern":"match manager.get_automation(id) {\n    Ok(record) => { /* ... */ }\n    Err(e) if e.to_string().contains(\"newer than supported\") => {\n        // Written by a newer build: ask for an upgrade, do not delete the file.\n        return Err(anyhow::anyhow!(\"automation {id} requires a newer Codewhale\"));\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Probe schema_version via serde_json::Value before full deserialization when versions may be mixed","Keep one Codewhale version across machines sharing the automations directory","Back up the automations directory before version switches","Never hand-edit schema_version without verifying field compatibility"],"tags":["rust","schema","version","compatibility","downgrade"],"backgroundTag":"schema-version-unsupported","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}