BoundaryML/baml · error · Error

Property ${name} not found.

Error message

Property ${name} not found.

What it means

ClassViewer.property(name) throws when the requested property does not exist on the viewed class definition. The JS viewer keeps a Set of known property names and validates membership before returning a ClassPropertyViewer, since there is no underlying object to return otherwise.

Source

Thrown at engine/language_client_typescript/type_builder.js:116

    }
    listProperties() {
        return this.bldr.listProperties();
    }
    type() {
        return this.bldr.field();
    }
}
exports.ClassAst = ClassAst;
class ClassViewer extends ClassAst {
    constructor(tb, name, properties = new Set()) {
        super(tb, name, properties);
    }
    listProperties() {
        return Array.from(this.properties).map((name) => [name, new ClassPropertyViewer()]);
    }
    property(name) {
        if (!this.properties.has(name)) {
            throw new Error(`Property ${name} not found.`);
        }
        return new ClassPropertyViewer();
    }
}
exports.ClassViewer = ClassViewer;
class ClassBuilder extends ClassAst {
    constructor(tb, name, properties = new Set()) {
        super(tb, name, properties);
    }
    addProperty(name, type) {
        if (this.properties.has(name)) {
            throw new Error(`Property ${name} already exists.`);
        }
        this.properties.add(name);
        return new ClassPropertyBuilder(this.bldr.property(name).setType(type));
    }
    listProperties() {
        return this.bldr.listProperties().map(([name, prop]) => [name, new ClassPropertyBuilder(prop)]);

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Call listProperties() first and confirm the exact property name before property()
  2. Fix the property-name typo/casing
  3. Ensure you add the property (addProperty) before attempting to view it
  4. Verify you are calling property() on the same ClassBuilder/Viewer that owns the property

Example fix

// before
const p = viewer.property("userName"); // throws, actual name is "username"
// after
const names = viewer.listProperties().map(([n]) => n);
if (names.includes("username")) {
  const p = viewer.property("username");
}
Defensive patterns

Strategy: validation

Validate before calling

const available = viewer.listProperties().map(([n]) => n);
if (!available.includes(name)) throw new Error(`property '${name}' not in [${available}]`);

Type guard

null

Try / catch

try { viewer.property(name); } catch (e) {
  if (String(e.message).includes('not found')) { /* handle missing property */ }
  else throw e;
}

Prevention

When it happens

Trigger: Calling viewer.property("x") for a property never added via addProperty; typo in the property name; querying a property added to a different ClassBuilder/Viewer instance.

Common situations: Refactors that renamed a class field without updating viewer lookups; introspection code driven by external config/JSON referencing stale field names; case-sensitivity mistakes (e.g. 'UserId' vs 'userId').

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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