BoundaryML/baml · error · anyhow::Error

No valid generator versions found

Error message

No valid generator versions found

What it means

Fallback error from `common_version_up_to_patch`: when the map of generator versions is empty or yields no valid entry, the function cannot determine any common version (the intended fallback to the runtime version also has nothing to work with), so this generic error is returned.

Solutions

  1. Add an explicit `baml_version` to every generator block in your .baml files.
  2. Ensure the version string is a valid semver (e.g. "0.81.0").
  3. Reinstall/upgrade the baml CLI and client packages so defaults match.
  4. Restart the language server after fixing the generator blocks.

Example fix

// before
generator lang_ts { output_type "openai" }
// after
generator lang_ts { output_type "openai" baml_version "0.81.0" }
Defensive patterns

Strategy: validation

Validate before calling

// Ensure every generator declares baml_version before loading the project
for gen in generators {
    assert!(gen.baml_version.is_some(), "generator {} missing baml_version", gen.name);
}

Prevention

When it happens

Trigger: A generator block exists but declares no parseable `baml_version`, or `get_common_generator_version`/`run` invokes version resolution with zero valid generator version entries collected.

Common situations: Generator blocks missing the `baml_version` field; malformed version strings dropped during collection; a project with generator syntax but no valid version metadata (very old or hand-edited .baml files).

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/3e8b06de1f23196b. Report an issue: GitHub.

Appendix: source

Thrown at engine/language_server/src/baml_project/mod.rs:1547

        );
        Err(message)
    // If there's only one major.minor version, return it with the highest patch
    } else if let Some((version, _)) = major_minor_versions.into_iter().next() {
        if let Some(highest_patch) = highest_patch_by_major_minor.get(&version) {
            // Parse the version string to create a proper semver::Version
            if let Ok(mut v) = Version::parse(&format!("{version}.0")) {
                // Update with the highest patch version
                v.patch = *highest_patch;
                Ok(v.to_string())
            } else {
                Ok(format!("{version}.{highest_patch}"))
            }
        } else {
            Ok(version)
        }
    // Fallback to the runtime version if no valid versions were found
    } else {
        Err(anyhow::anyhow!("No valid generator versions found"))
    }
}

fn get_dummy_value(
    indent: usize,
    allow_multiline: bool,
    t: &baml_runtime::TypeIR,
) -> Option<String> {
    let indent_str = "  ".repeat(indent);
    match t {
        baml_runtime::TypeIR::Primitive(t, _) => {
            let dummy = match t {
                TypeValue::String => {
                    if allow_multiline {
                        format!(
                            "#\"\n{indent1}hello world\n{indent_str}\"#",
                            indent1 = "  ".repeat(indent + 1)
                        )

View on GitHub (pinned to bd85ce9dee)