{"record":{"id":"ba90462230ea5989","repo":"BoundaryML/baml","slug":"enum-0-not-found","errorCode":null,"errorMessage":"Enum '{0}' not found","messagePattern":"Enum '(.+?)' not found","errorType":"exception","errorClass":"RenderError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/sys_ops/src/output_format.rs","lineNumber":11,"sourceCode":"use std::fmt::Write as _;\n\nuse ::sys_types::SapTy;\nuse baml_base::Literal as LiteralValue;\nuse indexmap::IndexMap;\nuse thiserror::Error;\n\n/// Error type for output format rendering.\n#[derive(Clone, Debug, Error)]\npub enum RenderError {\n    #[error(\"Enum '{0}' not found\")]\n    EnumNotFound(String),\n    #[error(\"Class '{0}' not found\")]\n    ClassNotFound(String),\n    #[error(\"Type '{0}' is not supported in outputs\")]\n    UnsupportedType(String),\n    #[error(\n        \"Non-regular recursive generic class '{class}' expands from '{ancestor}' to '{instantiation}'\"\n    )]\n    NonRegularRecursiveGeneric {\n        class: String,\n        ancestor: String,\n        instantiation: String,\n    },\n    #[error(\n        \"Output definitions '{first}' and '{second}' both render as '{rendered_name}' in the output schema\"\n    )]\n    RenderedClassNameCollision {\n        rendered_name: String,","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/sys_ops/src/output_format.rs#L1-L29","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nrender(value, registry_without_enums)  // EnumNotFound('Color')\n// after\nconst registry = load_registry(src_files_including_enums_baml);\nrender(value, registry)","handlingStrategy":"type-guard","validationCode":"function enumIsRenderable(registry, name) {\n  return registry.enums.some(en => en.name === name);\n}\n// call before render: enumIsRenderable(registry, valueTypeName)","typeGuard":"function isEnumNotFoundError(e) {\n  return e instanceof Error && /Enum '.*' not found/.test(e.message);\n}","tryCatchPattern":"try {\n  rendered = render(value, registry);\n} catch (e) {\n  if (isEnumNotFoundError(e)) {\n    rendered = String(value); // fallback rendering\n  } else throw e;\n}","preventionTips":["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"],"tags":["rendering","schema","enum"],"backgroundTag":"enum-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}