BoundaryML/baml · error · RenderError

Type alias definitions for '{rendered_name}' have non-equiva

Error message

Type alias definitions for '{rendered_name}' have non-equivalent targets '{first}' and '{second}'

What it means

Two BAML type aliases render to the same name but expand to different (non-equivalent) target types, so the schema cannot decide which target the rendered name refers to. The formatter raises RenderedTypeAliasNameCollision.

Source

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

        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}'"
    )]
    RenderedTypeAliasNameCollision {
        rendered_name: String,
        first: String,
        second: String,
    },
}

/// A value within an enum definition for output format rendering.
#[derive(Clone, Debug)]
pub struct EnumValue {
    pub name: String,
    pub alias: Option<String>,
    pub description: Option<String>,
    pub docstring: Option<String>,
}

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Rename one alias so rendered names are unique
  2. Make both alias targets identical (or equivalent types) if the shared name is intentional
  3. Remove the redundant duplicate alias

Example fix

// before
alias Name = string
alias Name = int
// after
alias Name = string
alias Count = int
Defensive patterns

Strategy: validation

Validate before calling

let aliases: HashMap<_,_> = aliases.iter().map(|a| (rendered_name(a), target(a))).collect();
for (name, t) in &aliases { /* ensure all aliases with same rendered name have equivalent targets */ }

Prevention

When it happens

Trigger: Generating an output schema where two alias definitions share a rendered name but their underlying types are not equivalent; raised via OutputFormatError::RenderedTypeAliasNameCollision.

Common situations: Aliasing the same name in two included schema blocks to different types; refactoring left two aliases pointing at divergent targets; copy-pasted alias edited in one place only.

Related errors


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