BoundaryML/baml · error · RenderError

Output definitions '{first}' and '{second}' both render as '

Error message

Output definitions '{first}' and '{second}' both render as '{rendered_name}' in the output schema

What it means

Two BAML class definitions render to the same name in the generated output schema, so the schema would contain two types with one identifier. The output formatter detects the collision while assigning rendered names and refuses to emit an ambiguous schema.

Source

Thrown at baml_language/crates/sys_ops/src/output_format.rs:25

/// 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,
    },
    #[error(
        "Output definitions '{first}' and '{second}' both render as '{rendered_name}' in the output schema"
    )]
    RenderedEnumNameCollision {
        rendered_name: String,
        first: String,
        second: String,
    },
    #[error(
        "Type alias definitions for '{rendered_name}' have non-equivalent targets '{first}' and '{second}'"
    )]

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Rename one of the conflicting classes so rendered names differ
  2. Adjust the naming/rendering configuration (prefixes, aliases) so the two classes no longer collide
  3. Merge the two classes if they are semantically duplicate

Example fix

// before
class Address { ... }
class address { ... }
// after
class ShippingAddress { ... }
class BillingAddress { ... }
Defensive patterns

Strategy: validation

Validate before calling

let names: Vec<_> = classes.iter().map(rendered_name).collect();
assert_unique(&names)?; // fail fast before schema generation

Prevention

When it happens

Trigger: Calling the output-schema generation with two distinct classes whose rendered (renamed/shortened) names normalize to the same string; raised via OutputFormatError::RenderedClassNameCollision.

Common situations: Renaming or prefix-stripping logic collapsing distinct class names; two classes differing only in case or module prefix; generated schema merging multiple blocks whose classes alias to one name.

Related errors


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