{"record":{"id":"d87a9bae1dc6669a","repo":"BoundaryML/baml","slug":"type-alias-definitions-for-rendered-name-have-non-equivalent","errorCode":null,"errorMessage":"Type alias definitions for '{rendered_name}' have non-equivalent targets '{first}' and '{second}'","messagePattern":"Type alias definitions for '(.+?)' have non-equivalent targets '(.+?)' and '(.+?)'","errorType":"exception","errorClass":"RenderError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/sys_ops/src/output_format.rs","lineNumber":41,"sourceCode":"        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,\n        first: String,\n        second: String,\n    },\n    #[error(\n        \"Output definitions '{first}' and '{second}' both render as '{rendered_name}' in the output schema\"\n    )]\n    RenderedEnumNameCollision {\n        rendered_name: String,\n        first: String,\n        second: String,\n    },\n    #[error(\n        \"Type alias definitions for '{rendered_name}' have non-equivalent targets '{first}' and '{second}'\"\n    )]\n    RenderedTypeAliasNameCollision {\n        rendered_name: String,\n        first: String,\n        second: String,\n    },\n}\n\n/// A value within an enum definition for output format rendering.\n#[derive(Clone, Debug)]\npub struct EnumValue {\n    pub name: String,\n    pub alias: Option<String>,\n    pub description: Option<String>,\n    pub docstring: Option<String>,\n}\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/sys_ops/src/output_format.rs#L23-L59","documentation":"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.","triggerScenarios":"Generating an output schema where two alias definitions share a rendered name but their underlying types are not equivalent; raised via OutputFormatError::RenderedTypeAliasNameCollision.","commonSituations":"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.","solutions":["Rename one alias so rendered names are unique","Make both alias targets identical (or equivalent types) if the shared name is intentional","Remove the redundant duplicate alias"],"exampleFix":"// before\nalias Name = string\nalias Name = int\n// after\nalias Name = string\nalias Count = int","handlingStrategy":"validation","validationCode":"let aliases: HashMap<_,_> = aliases.iter().map(|a| (rendered_name(a), target(a))).collect();\nfor (name, t) in &aliases { /* ensure all aliases with same rendered name have equivalent targets */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give aliases unique rendered names unless intentionally duplicating a target","Keep alias targets in sync when refactoring","Validate alias equivalence in schema tests"],"tags":["baml","schema","type-alias","naming-collision"],"backgroundTag":"conflicting-config-options","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"}