BoundaryML/baml · error · RenderError
Enum '{0}' not found
Error message
Enum '{0}' not found What it means
RenderError::EnumNotFound is raised by the sys_ops output_format renderer when asked to render a value whose enum name does not exist in the type registry available to the renderer. The '{0}' placeholder is the enum name string. It is a lookup failure, not a value problem: the type itself is missing from the loaded schema.
Source
Thrown at baml_language/crates/sys_ops/src/output_format.rs:11
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,View on GitHub (pinned to bd85ce9dee)
Solutions
- Load all BAML source files defining the referenced enum into the renderer's registry
- Regenerate client code after renaming/removing enums
- Fix the enum name typo in the code or template referencing it
- Check renderer setup so the correct project's type registry is attached
Example fix
// before
render(value, registry_without_enums) // EnumNotFound('Color')
// after
const registry = load_registry(src_files_including_enums_baml);
render(value, registry) Defensive patterns
Strategy: type-guard
Validate before calling
function enumIsRenderable(registry, name) {
return registry.enums.some(en => en.name === name);
}
// call before render: enumIsRenderable(registry, valueTypeName) Type guard
function isEnumNotFoundError(e) {
return e instanceof Error && /Enum '.*' not found/.test(e.message);
} Try / catch
try {
rendered = render(value, registry);
} catch (e) {
if (isEnumNotFoundError(e)) {
rendered = String(value); // fallback rendering
} else throw e;
} Prevention
- Load all .baml sources defining referenced enums into the registry
- Regenerate client code after schema renames
- Grep templates for enum names and validate them against the registry
- Run schema linting in CI to catch dangling references
When it happens
Trigger: Rendering output for a response referencing an enum that is not defined in the loaded BAML sources, or after renaming an enum without regenerating/reloading the client.
Common situations: Partial file sets given to the renderer, stale generated code after schema edits, or typos in enum names in templates/config that reference output types.
Related errors
- Class '{0}' not found
- Type '{0}' is not supported in outputs
- Enum {name} not found
- Enum {} does not exist
- Enum {} does not exist
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/ba90462230ea5989.
Report an issue: GitHub.