{"record":{"id":"cfa0f41b7406cc33","repo":"BoundaryML/baml","slug":"legacy-get-is-not-supported-n-nplease-remove-them-from-your","errorCode":null,"errorMessage":"Legacy @get is not supported.\\n{}\\nPlease remove them from your code. See https://docs.boundaryml.com","messagePattern":"Legacy @get is not supported\\.\\\\n(.+?)\\\\nPlease remove them from your code\\. See https://docs\\.boundaryml\\.com","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/ir_features.rs","lineNumber":34,"sourceCode":"            v1_functions,\n            v2_functions,\n            class_getters,\n        }\n    }\n\n    pub fn err_if_legacy(&self) -> anyhow::Result<()> {\n        // TODO: @hellovai consider if we want to keep this check\n        // Option 1 (current): instead we give a runtime error if we encounter a legacy function.\n        // Option 2 (if uncommented): we require that all legacy functions are removed before the code is used by the runtime.\n\n        // if !self.v1_functions.is_empty() {\n        //     return Err(anyhow::anyhow!(\n        //         \"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(\", \")\n        //     ));\n        // }\n\n        if !self.class_getters.is_empty() {\n            return Err(anyhow::anyhow!(\n                \"Legacy @get is not supported.\\n{}\\nPlease remove them from your code. See https://docs.boundaryml.com\",\n                self.class_getters\n                    .iter()\n                    .map(|(class, fields)| {\n                        format!(\n                            \"  {}: {}\",\n                            class,\n                            fields.join(\", \")\n                        )\n                    })\n                    .collect::<Vec<_>>()\n                    .join(\"\\n\")\n            ));\n        }\n\n        Ok(())\n    }\n}","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/ir_features.rs#L16-L52","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove all @get annotations from class fields in your .baml files (the error lists each class and field).","Replace legacy getter behavior with explicitly exposing fields or using modern BAML class syntax per docs.boundaryml.com.","If a dependency/vendor baml file contains @get, regenerate or update that file.","Pin to a much older BAML version only as a temporary last resort while migrating."],"exampleFix":"// before (baml)\nclass Resume {\n  name string @get\n}\n// after (baml)\nclass Resume {\n  name string\n}","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# fail CI if legacy @get remains in baml sources\ngrep -RIn --include='*.baml' '@get' baml_src/ && { echo 'legacy @get found'; exit 1; } || true","typeGuard":null,"tryCatchPattern":"match IntermediateRepr::new(&ast) {\n    Ok(ir) => ir,\n    Err(e) if e.to_string().contains(\"Legacy @get is not supported\") => {\n        eprintln!(\"Migration required: remove @get annotations per the listed classes/fields\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Add a lint/CI grep for '@get' in .baml files before upgrading BAML.","Update team templates and internal docs to the current class syntax.","Audit vendored/generated .baml files when adopting a newer BAML version."],"tags":["rust","deprecation","baml-schema","migration"],"backgroundTag":"deprecated-api-usage","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"}