{"record":{"id":"2af5f1f8923cf765","repo":"BoundaryML/baml","slug":"multiple-major-minor-versions-detected-versions-str-major","errorCode":null,"errorMessage":"Multiple major.minor versions detected: {versions_str}. Major and minor versions must match across all generators.","messagePattern":"Multiple major\\.minor versions detected: (.+?)\\. Major and minor versions must match across all generators\\.","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"engine/language_server/src/baml_project/mod.rs","lineNumber":1527,"sourceCode":"                        *highest_patch = version.patch;\n                    }\n                })\n                .or_insert(version.patch);\n        } else {\n            tracing::warn!(\"Invalid semver version in generator: {}\", version_str);\n            // Consider how to handle invalid versions - for now, we ignore them for the check\n        }\n    }\n\n    // If there's more than one major.minor version, return an error\n    if major_minor_versions.len() > 1 {\n        let versions_str = major_minor_versions\n            .keys()\n            .map(|v| format!(\"'{v}'\"))\n            .collect::<Vec<_>>()\n            .join(\", \");\n\n        let message = anyhow::anyhow!(\n            \"Multiple major.minor versions detected: {versions_str}. Major and minor versions must match across all generators.\"\n        );\n        Err(message)\n    // If there's only one major.minor version, return it with the highest patch\n    } else if let Some((version, _)) = major_minor_versions.into_iter().next() {\n        if let Some(highest_patch) = highest_patch_by_major_minor.get(&version) {\n            // Parse the version string to create a proper semver::Version\n            if let Ok(mut v) = Version::parse(&format!(\"{version}.0\")) {\n                // Update with the highest patch version\n                v.patch = *highest_patch;\n                Ok(v.to_string())\n            } else {\n                Ok(format!(\"{version}.{highest_patch}\"))\n            }\n        } else {\n            Ok(version)\n        }\n    // Fallback to the runtime version if no valid versions were found","sourceCodeStart":1509,"sourceCodeEnd":1545,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_server/src/baml_project/mod.rs#L1509-L1545","documentation":"`common_version_up_to_patch` collects the baml versions declared by all generators in the project. If generators declare different major.minor versions, no single common version can be chosen, so this error is returned listing the conflicting versions. All generators in one project must agree on major.minor.","triggerScenarios":"Multiple `generator` blocks in .baml files (or generator configs feeding `get_common_generator_version` / `run`) specify different `baml_version` values that differ in major or minor, e.g. 0.80.x vs 0.81.x.","commonSituations":"Upgrading one generator's baml_version but not others after a `baml-cli` update; copying a .baml file from another project with an older pinned version; partially migrated monorepos.","solutions":["Align the `baml_version` in every generator block to the same major.minor version.","Run your package manager's baml upgrade (e.g. `pip install -U baml-py` / `npm update @baml` style) across all generator runtimes.","Delete or consolidate duplicate generator blocks pinned to old versions.","Re-save/restart the language server after unifying versions."],"exampleFix":"// before (conflicting)\ngenerator lang_py { baml_version \"0.80.1\" }\ngenerator lang_ts { baml_version \"0.81.0\" }\n// after (aligned)\ngenerator lang_py { baml_version \"0.81.0\" }\ngenerator lang_ts { baml_version \"0.81.0\" }","handlingStrategy":"validation","validationCode":"// Pre-check generator versions across .baml files\nlet versions: Vec<String> = sources.iter().filter_map(|s| extract_baml_version(s)).collect();\nlet majors_minors: std::collections::HashSet<String> =\n    versions.iter().map(|v| v.rsplit_once('.').unwrap().0.to_string()).collect();\nif majors_minors.len() > 1 {\n    panic!(\"align generator baml_version major.minor: {majors_minors:?}\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Upgrade all generators' baml_version together, never one at a time.","Pin one version in a shared config and reference it consistently.","After copying .baml files between projects, reconcile their generator blocks."],"tags":["versioning","config","baml","generators"],"backgroundTag":"conflicting-config-options","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}