BoundaryML/baml · error
Property not found: {} in class {}
Error message
Property not found: {} in class {} What it means
ClassBuilder::property looks up an existing property to modify. If the property is not present in the IR's class definition (find_field returns None) and not otherwise resolvable, it bails with 'Property not found'. Only properties that already exist can be retrieved this way; new ones must be added with add_property.
Source
Thrown at engine/language_client_cffi/src/raw_ptr_wrapper/type_builder/objects.rs:356
prop.lock().unwrap().set_type(field_type);
Ok(self.create_property(name, rt))
}
pub fn property(&self, rt: &BamlRuntime, name: &str) -> anyhow::Result<ClassPropertyBuilder> {
self.mode.at_least(NodeRW::ReadOnly)?;
let cls = self.cls(rt)?;
let builder = cls.lock().unwrap();
match builder.maybe_get_property(name) {
Some(_) => Ok(self.create_property(name, rt)),
None => {
// if the IR has the property, then its valid to add it again
if let Ok(cls) = rt.ir.find_class(self.class_name.as_str()) {
if cls.find_field(name).is_some() {
let _ = builder.upsert_property(name);
Ok(self.create_property(name, rt))
} else {
anyhow::bail!("Property not found: {} in class {}", name, self.class_name)
}
} else {
anyhow::bail!("Property not found: {} in class {}", name, self.class_name)
}
}
}
}
pub fn is_from_ast(&self, rt: &BamlRuntime) -> anyhow::Result<bool> {
self.mode.at_least(NodeRW::ReadOnly)?;
Ok(rt.ir.find_class(self.class_name.as_str()).is_ok())
}
}
#[derive(Debug, Clone)]
pub struct ClassPropertyBuilder {
type_builder: RuntimeTypeBuilder,
class_name: String,View on GitHub (pinned to bd85ce9dee)
Solutions
- Add the property first with cb.add_property(rt, name, type) before lookup
- Verify the exact property name against the class definition (case-sensitive)
- Use list_properties to confirm the field exists before lookup
Example fix
// before
let p = cb.property(rt, "nmae")?; // typo -> not found
// after
let p = match cb.property(rt, "name") {
Ok(p) => p,
Err(_) => cb.add_property(rt, "name", tb.string_type())?,
}; Defensive patterns
Strategy: try-catch
Validate before calling
# check before lookup
if "name" not in cb.list_properties(rt):
cb.add_property(rt, "name", tb.string()) Try / catch
try:
p = cb.property(rt, name)
except Exception as e:
if "not found" in str(e):
cb.add_property(rt, name, ty)
p = cb.property(rt, name)
else:
raise Prevention
- Verify property names with list_properties before lookup
- Call add_property for new fields instead of property()
- Track BAML source renames and update builder code accordingly
When it happens
Trigger: Calling cb.property(rt, "field") for a property name that the class does not define, whether from a typo or because the property was never added.
Common situations: Typo in property name; calling .property() before add_property(); the property was removed/renamed in the BAML source while builder code still references the old name.
Related errors
- Class with name {name} does not exist
- Class not found: {}
- Property already exists: {} in class {}
- Class {} not found
- Class with name {name} already exists
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/85e74ea4c6694241.
Report an issue: GitHub.