{"record":{"id":"9a3cafc02f90e63c","repo":"Hmbown/CodeWhale","slug":"dsh-receipt-has-schema-version-this-build-u","errorCode":null,"errorMessage":"DSH receipt {} has schema_version {} (this build understands {})","messagePattern":"DSH receipt (.+?) has schema_version (.+?) \\(this build understands (.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/dsh/receipt.rs","lineNumber":121,"sourceCode":"\nimpl Default for DshReceiptDocument {\n    fn default() -> Self {\n        Self {\n            schema_version: RECEIPT_SCHEMA_VERSION,\n            current: None,\n            history: Vec::new(),\n        }\n    }\n}\n\nimpl DshReceiptDocument {\n    pub(crate) fn load(path: &Path) -> Result<Self> {\n        match std::fs::read(path) {\n            Ok(bytes) => {\n                let doc: Self = serde_json::from_slice(&bytes)\n                    .with_context(|| format!(\"parse DSH receipt {}\", path.display()))?;\n                if doc.schema_version > RECEIPT_SCHEMA_VERSION {\n                    anyhow::bail!(\n                        \"DSH receipt {} has schema_version {} (this build understands {})\",\n                        path.display(),\n                        doc.schema_version,\n                        RECEIPT_SCHEMA_VERSION\n                    );\n                }\n                Ok(doc)\n            }\n            Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(Self::default()),\n            Err(error) => {\n                Err(error).with_context(|| format!(\"read DSH receipt {}\", path.display()))\n            }\n        }\n    }\n\n    pub(crate) fn push(&mut self, entry: DshReceiptEntry) {\n        self.history.push(entry);\n        if self.history.len() > MAX_HISTORY {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/dsh/receipt.rs#L103-L139","documentation":"The DSH receipt file on disk declares a `schema_version` newer than RECEIPT_SCHEMA_VERSION, i.e. it was written by a newer build of codewhale. The loader refuses to parse/upgrade it to avoid data loss or misinterpretation, wrapping the failure in a parse-context error for the file path.","triggerScenarios":"Loading the DSH receipt (DshReceiptDocument::load) after downgrading the binary, switching branches, or sharing a receipt written by a newer codewhale version where doc.schema_version > RECEIPT_SCHEMA_VERSION.","commonSituations":"Rolling back codewhale after an upgrade; multiple codewhale builds of different versions pointed at the same workspace/config directory; restoring a receipt backup from a newer install.","solutions":["Upgrade codewhale to the version that wrote the receipt","Back up the receipt file and delete it, then re-run the DSH connect flow to recreate it at the current schema","Avoid mixing codewhale versions against the same workspace"],"exampleFix":"// before\ncodewhale-0.9 dsh connect   # writes schema_version 2\n// after\ncargo build # ensure binary >= version that wrote the receipt, then retry","handlingStrategy":"try-catch","validationCode":"let raw = std::fs::read_to_string(&receipt_path)?;\nlet v: serde_json::Value = serde_json::from_str(&raw)?;\nif v[\"schema_version\"].as_u64().unwrap_or(0) > RECEIPT_SCHEMA_VERSION { /* upgrade binary or recreate */ }","typeGuard":null,"tryCatchPattern":"match DshReceiptDocument::load(&path) { Err(e) if e.to_string().contains(\"schema_version\") => { backup_and_recreate_receipt(); }, Err(e) => return Err(e.into()), doc => doc }","preventionTips":["Pin one codewhale version per workspace","After a downgrade, expect receipt incompatibility and recreate via connect","Keep backups before swapping binaries"],"tags":["dsh","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"}