{"record":{"id":"0c37760a87e0c48f","repo":"sigoden/aichat","slug":"incompatible-version","errorCode":null,"errorMessage":"Incompatible version","messagePattern":"Incompatible version","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/mod.rs","lineNumber":1902,"sourceCode":"        ensure_parent_exists(&model_override_path)?;\n        std::fs::write(&model_override_path, models_override_data)\n            .with_context(|| format!(\"Failed to write to '{}'\", model_override_path.display()))?;\n        println!(\"✓ Updated '{}'\", model_override_path.display());\n        Ok(())\n    }\n\n    pub fn loal_models_override() -> Result<Vec<ProviderModels>> {\n        let model_override_path = Self::models_override_file();\n        let err = || {\n            format!(\n                \"Failed to load models at '{}'\",\n                model_override_path.display()\n            )\n        };\n        let content = read_to_string(&model_override_path).with_context(err)?;\n        let models_override: ModelsOverride = serde_yaml::from_str(&content).with_context(err)?;\n        if models_override.version != env!(\"CARGO_PKG_VERSION\") {\n            bail!(\"Incompatible version\")\n        }\n        Ok(models_override.list)\n    }\n\n    pub fn light_theme(&self) -> bool {\n        matches!(self.theme.as_deref(), Some(\"light\"))\n    }\n\n    pub fn render_options(&self) -> Result<RenderOptions> {\n        let theme = if self.highlight {\n            let theme_mode = if self.light_theme() { \"light\" } else { \"dark\" };\n            let theme_filename = format!(\"{theme_mode}.tmTheme\");\n            let theme_path = Self::local_path(&theme_filename);\n            if theme_path.exists() {\n                let theme = ThemeSet::get_theme(&theme_path)\n                    .with_context(|| format!(\"Invalid theme at '{}'\", theme_path.display()))?;\n                Some(theme)\n            } else {","sourceCodeStart":1884,"sourceCodeEnd":1920,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/config/mod.rs#L1884-L1920","documentation":"Thrown while loading a models override file (models_override YAML): after reading and deserializing it, the `version` field is compared against env!(\"CARGO_PKG_VERSION\"). A mismatch means the override file was produced by (or written for) a different version of the tool and may not be structurally compatible, so it is rejected.","triggerScenarios":"Upgrading or downgrading the binary while keeping an old models-override YAML whose `version:` field no longer equals the current crate version; hand-editing the override file and forgetting to update its version field.","commonSituations":"brew/npm upgrade of aichat leaving a stale override file in the config dir; syncing config files across machines running different versions; manually authoring an override file with a wrong/old version string.","solutions":["Regenerate the models override file with the current version (re-run the command that creates it).","Edit the override YAML and set its `version` field to the running binary's version (e.g. from `aichat --version`).","Delete the stale override file so it is recreated on next use."],"exampleFix":"// models-override.yaml — before\nversion: 0.20.0\n// after\nversion: 0.25.0  # must match CARGO_PKG_VERSION of the installed binary","handlingStrategy":"validation","validationCode":"let v: serde_yaml::Value = serde_yaml::from_str(&content)?; if v[\"version\"].as_str() != Some(env!(\"CARGO_PKG_VERSION\")) { eprintln!(\"override file version mismatch; regenerate it\"); }","typeGuard":null,"tryCatchPattern":"match load_models_override() { Err(e) if e.to_string() == \"Incompatible version\" => eprintln!(\"Regenerate the models override file\"), other => other?, }","preventionTips":["Regenerate override files after every binary upgrade","Match override file version to `aichat --version` output","Don't share override files across machines with different versions"],"tags":["version-mismatch","config-file","upgrade"],"backgroundTag":"version-incompatible","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}