{"record":{"id":"13eb47b6dcc6c470","repo":"databendlabs/databend","slug":"invalid-data-version-this-program-version-i","errorCode":null,"errorMessage":"invalid data version: {:?}, This program version is {:?}; The latest compatible program version is: {:?}","messagePattern":"invalid data version: (.+?), This program version is (.+?); The latest compatible program version is: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/control/src/reading.rs","lineNumber":46,"sourceCode":"    lines: &mut Peekable<Lines<B>>,\n) -> anyhow::Result<DataVersion> {\n    #[allow(clippy::useless_conversion)]\n    let first = lines\n        .peek()\n        .ok_or_else(|| anyhow::anyhow!(\"no data found\"))?;\n\n    let first_line = match first {\n        Ok(l) => l,\n        Err(e) => {\n            return Err(anyhow::anyhow!(\"{}\", e));\n        }\n    };\n\n    // First line is the data header that containing version.\n    let version = read_version(first_line)?;\n\n    if !DATA_VERSION.is_compatible(version) {\n        return Err(anyhow::anyhow!(\n            \"invalid data version: {:?}, This program version is {:?}; The latest compatible program version is: {:?}\",\n            version,\n            DATA_VERSION,\n            version.max_compatible_working_version(),\n        ));\n    }\n    Ok(version)\n}\n\npub fn read_version(first_line: &str) -> anyhow::Result<DataVersion> {\n    let (tree_name, kv_entry): (String, RaftStoreEntry) = serde_json::from_str(first_line)?;\n\n    let version = if tree_name == TREE_HEADER {\n        // There is a explicit header.\n        if let RaftStoreEntry::DataHeader { key, value } = &kv_entry {\n            assert_eq!(key, \"header\", \"The key can only be 'header'\");\n            value.0.version\n        } else {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/control/src/reading.rs#L28-L64","documentation":"After reading the header line, validate_version parses the DataVersion and checks DATA_VERSION.is_compatible(version). If the data on disk was written by an incompatible program version, it reports the data's version, the current program version, and the latest compatible program version. This protects against restoring or upgrading meta data across unsupported version boundaries.","triggerScenarios":"Calling validate_version on a dump whose header version fails DATA_VERSION.is_compatible — e.g. data written by a much newer or older Databend meta-service build.","commonSituations":"Restoring a backup made by a newer Databend into an older binary; skipping multiple releases during upgrade; mixing release tags when running meta upgrade tooling.","solutions":["Upgrade the binary to a version whose DATA_VERSION is compatible with the dump (usually the newest release)","Check the printed 'latest compatible program version' and pin that release for the migration","Follow the documented multi-step upgrade path instead of jumping versions","Regenerate the dump with a compatible source version if the data is too new"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// after reading header\nlet v = read_version(first_line)?;\nif !DATA_VERSION.is_compatible(v) {\n    eprintln!(\"dump v{:?} incompatible with binary v{:?}; upgrade first\", v, DATA_VERSION);\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":"match validate_version(&mut lines) {\n    Err(e) if e.to_string().contains(\"invalid data version\") => {\n        plan_upgrade_from(&e.to_string());\n    }\n    other => other?,\n}","preventionTips":["Keep backup/restore binaries on the same release line as the data","Follow the documented multi-step upgrade path","Record the Databend version in backup metadata"],"tags":["meta-service","data-version","compatibility","upgrade"],"backgroundTag":"invalid-argument-value","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}