BoundaryML/baml · error · RenderError
Class '{0}' not found
Error message
Class '{0}' not found What it means
RenderError::ClassNotFound is raised by the sys_ops output_format renderer when a class referenced during output rendering cannot be found in the renderer's type registry. The '{0}' placeholder is the class name. Like EnumNotFound, it indicates a schema lookup failure: the class definition is missing from the loaded types.
Source
Thrown at baml_language/crates/sys_ops/src/output_format.rs:13
use std::fmt::Write as _;
use ::sys_types::SapTy;
use baml_base::Literal as LiteralValue;
use indexmap::IndexMap;
use thiserror::Error;
/// Error type for output format rendering.
#[derive(Clone, Debug, Error)]
pub enum RenderError {
#[error("Enum '{0}' not found")]
EnumNotFound(String),
#[error("Class '{0}' not found")]
ClassNotFound(String),
#[error("Type '{0}' is not supported in outputs")]
UnsupportedType(String),
#[error(
"Non-regular recursive generic class '{class}' expands from '{ancestor}' to '{instantiation}'"
)]
NonRegularRecursiveGeneric {
class: String,
ancestor: String,
instantiation: String,
},
#[error(
"Output definitions '{first}' and '{second}' both render as '{rendered_name}' in the output schema"
)]
RenderedClassNameCollision {
rendered_name: String,
first: String,
second: String,View on GitHub (pinned to bd85ce9dee)
Solutions
- Ensure the .baml file defining the class is loaded into the renderer registry
- Regenerate client code after class renames or deletions
- Correct the class name in the referencing code/template
- Verify the renderer is initialized with the same project sources as the runtime
Example fix
// before
render(result, registryMissing(User)) // ClassNotFound('User')
// after
const registry = build_registry([user_baml, ...other_sources]);
render(result, registry) Defensive patterns
Strategy: type-guard
Validate before calling
function classIsRenderable(registry, name) {
return registry.classes.some(c => c.name === name);
}
// call before render: classIsRenderable(registry, 'User') Type guard
function isClassNotFoundError(e) {
return e instanceof Error && /Class '.*' not found/.test(e.message);
} Try / catch
try {
rendered = render(value, registry);
} catch (e) {
if (isClassNotFoundError(e)) {
rendered = { __missing_class__: e.message.match(/Class '(.*)' not found/)[1] };
} else throw e;
} Prevention
- Ensure every class referenced by output types is loaded into the registry
- Regenerate after renaming/deleting classes in .baml files
- Validate generated-code class references against current sources in CI
- Initialize the renderer with the full project source set
When it happens
Trigger: Rendering output whose type references a class absent from the loaded BAML sources, or generated code that references a class deleted/renamed since generation.
Common situations: Schema files not fully loaded into the renderer, drift between generated client code and current .baml sources, or misspelled class names in dynamic output schemas.
Related errors
- Enum '{0}' not found
- Type '{0}' is not supported in outputs
- Class {name} not found
- Class {} does not exist
- Class {} not found
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/23b2effefae793f3.
Report an issue: GitHub.