BoundaryML/baml · error

Legacy @get is not supported.\n

Error message

Legacy @get is not supported.\n{}\nPlease remove them from your code. See https://docs.boundaryml.com

What it means

err_if_legacy rejects BAML source using the deprecated legacy @get class-field syntax. The runtime collects class_getters from the parsed AST and refuses to proceed, telling the user to remove them and consult the BoundaryML docs. Legacy functions are similarly deprecated (see the commented-out block).

Solutions

  1. Remove all @get annotations from class fields in your .baml files (the error lists each class and field).
  2. Replace legacy getter behavior with explicitly exposing fields or using modern BAML class syntax per docs.boundaryml.com.
  3. If a dependency/vendor baml file contains @get, regenerate or update that file.
  4. Pin to a much older BAML version only as a temporary last resort while migrating.

Example fix

// before (baml)
class Resume {
  name string @get
}
// after (baml)
class Resume {
  name string
}
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# fail CI if legacy @get remains in baml sources
grep -RIn --include='*.baml' '@get' baml_src/ && { echo 'legacy @get found'; exit 1; } || true

Try / catch

match IntermediateRepr::new(&ast) {
    Ok(ir) => ir,
    Err(e) if e.to_string().contains("Legacy @get is not supported") => {
        eprintln!("Migration required: remove @get annotations per the listed classes/fields");
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Loading/compiling a .baml file that declares @get annotations on class fields, so ir.class_getters is non-empty when err_if_legacy runs during IR construction.

Common situations: Migrating very old BAML projects (pre-current-schema syntax) to a modern BAML version; copying example code from an outdated tutorial or blog post; a team member still using v1-era syntax.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at engine/baml-runtime/src/internal/ir_features.rs:34

            v1_functions,
            v2_functions,
            class_getters,
        }
    }

    pub fn err_if_legacy(&self) -> anyhow::Result<()> {
        // TODO: @hellovai consider if we want to keep this check
        // Option 1 (current): instead we give a runtime error if we encounter a legacy function.
        // Option 2 (if uncommented): we require that all legacy functions are removed before the code is used by the runtime.

        // if !self.v1_functions.is_empty() {
        //     return Err(anyhow::anyhow!(
        //         "Legacy functions are not supported.\n{} legacy functions found.\n  {}\nPlease migrate to the new function format. See https://docs.boundaryml.com", self.v1_functions.len(), self.v1_functions.join(", ")
        //     ));
        // }

        if !self.class_getters.is_empty() {
            return Err(anyhow::anyhow!(
                "Legacy @get is not supported.\n{}\nPlease remove them from your code. See https://docs.boundaryml.com",
                self.class_getters
                    .iter()
                    .map(|(class, fields)| {
                        format!(
                            "  {}: {}",
                            class,
                            fields.join(", ")
                        )
                    })
                    .collect::<Vec<_>>()
                    .join("\n")
            ));
        }

        Ok(())
    }
}

View on GitHub (pinned to bd85ce9dee)