sigoden/aichat · error
Incompatible version
Error message
Incompatible version
What it means
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.
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.
Example fix
// models-override.yaml — before version: 0.20.0 // after version: 0.25.0 # must match CARGO_PKG_VERSION of the installed binary
Defensive patterns
Strategy: validation
Validate before calling
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"); } Try / catch
match load_models_override() { Err(e) if e.to_string() == "Incompatible version" => eprintln!("Regenerate the models override file"), other => other?, } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/0c37760a87e0c48f.
Report an issue: GitHub.
Appendix: source
Thrown at src/config/mod.rs:1902
ensure_parent_exists(&model_override_path)?;
std::fs::write(&model_override_path, models_override_data)
.with_context(|| format!("Failed to write to '{}'", model_override_path.display()))?;
println!("✓ Updated '{}'", model_override_path.display());
Ok(())
}
pub fn loal_models_override() -> Result<Vec<ProviderModels>> {
let model_override_path = Self::models_override_file();
let err = || {
format!(
"Failed to load models at '{}'",
model_override_path.display()
)
};
let content = read_to_string(&model_override_path).with_context(err)?;
let models_override: ModelsOverride = serde_yaml::from_str(&content).with_context(err)?;
if models_override.version != env!("CARGO_PKG_VERSION") {
bail!("Incompatible version")
}
Ok(models_override.list)
}
pub fn light_theme(&self) -> bool {
matches!(self.theme.as_deref(), Some("light"))
}
pub fn render_options(&self) -> Result<RenderOptions> {
let theme = if self.highlight {
let theme_mode = if self.light_theme() { "light" } else { "dark" };
let theme_filename = format!("{theme_mode}.tmTheme");
let theme_path = Self::local_path(&theme_filename);
if theme_path.exists() {
let theme = ThemeSet::get_theme(&theme_path)
.with_context(|| format!("Invalid theme at '{}'", theme_path.display()))?;
Some(theme)
} else {View on GitHub (pinned to 82976d349a)