BoundaryML/baml · error · Error

Property ${name} not found.

Error message

Property ${name} not found.

What it means

ClassAst.property (viewer API) throws 'Property <name> not found.' when the requested property name is not among the properties registered for the class being viewed. The viewer keeps a Set of property names and rejects unknown lookups instead of returning null. It is a read-path companion to the addProperty duplicate check.

Source

Thrown at engine/language_client_typescript/typescript_src/type_builder.ts:169

    return this.bldr.field()
  }
}

export class ClassViewer<ClassName extends string, Properties extends string = string> extends ClassAst<
  ClassName,
  Properties
> {
  constructor(tb: _TypeBuilder, name: ClassName, properties: Set<Properties | string> = new Set()) {
    super(tb, name, properties)
  }

  listProperties(): Array<[string, ClassPropertyViewer]> {
    return Array.from(this.properties).map((name) => [name, new ClassPropertyViewer()])
  }

  property(name: string): ClassPropertyViewer {
    if (!this.properties.has(name)) {
      throw new Error(`Property ${name} not found.`)
    }
    return new ClassPropertyViewer()
  }
}

export class ClassBuilder<ClassName extends string, Properties extends string = string> extends ClassAst<
  ClassName,
  Properties
> {
  constructor(tb: _TypeBuilder, name: ClassName, properties: Set<Properties | string> = new Set()) {
    super(tb, name, properties)
  }

  addProperty<S extends string>(name: RestrictNot<ClassName, S, Properties>, type: FieldType): ClassPropertyBuilder {
    if (this.properties.has(name)) {
      throw new Error(`Property ${name} already exists.`)
    }
    this.properties.add(name)

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Call listProperties() first and confirm the exact property name before lookup.
  2. Fix the property name spelling/casing in the lookup call.
  3. Add the missing property via the ClassBuilder's addProperty before inspecting it.

Example fix

// before
const p = viewer.property('userName') // throws if absent
// 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 exists = viewer.listProperties().some(([n]) => n === name)
if (!exists) throw new Error(`property '${name}' missing before lookup`)

Try / catch

try {
  const p = viewer.property(name)
} catch (e) {
  if (e.message.includes('not found')) return null
  throw e
}

Prevention

When it happens

Trigger: Calling clsViewer.property('foo') where 'foo' was never added via addProperty on the builder, or after a typo / case mismatch in the property name.

Common situations: Inspecting a dynamically built class whose properties depend on runtime data; accessing a property renamed in a schema update.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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