{"record":{"id":"a97ea07a9fc2a331","repo":"BoundaryML/baml","slug":"the-master-member-cannot-be-interned-the-master-is-the-plain","errorCode":null,"errorMessage":"the master member cannot be interned: the master is the plain tree every other member converts through","messagePattern":"the master member cannot be interned: the master is the plain tree every other member converts through","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_type_macros/src/parse.rs","lineNumber":340,"sourceCode":"                    ChildRef::Named(name) => {\n                        let idx = member_index(name)?;\n                        // A plain member cannot nest an interned member: the\n                        // structural conversion walkers would have to convert\n                        // through a handle, which only the hand-written\n                        // boundary conversions can do.\n                        if matches!(members[idx].child, ChildRef::Interned(_)) {\n                            return Err(syn::Error::new(\n                                name.span(),\n                                format!(\n                                    \"interned member `{name}` cannot be another member's child\"\n                                ),\n                            ));\n                        }\n                        Child::Member(idx)\n                    }\n                    ChildRef::Interned(handle) => {\n                        if m.name == master_ident {\n                            return Err(syn::Error::new(\n                                m.name.span(),\n                                \"the master member cannot be interned: the master is the \\\n                                 plain tree every other member converts through\",\n                            ));\n                        }\n                        Child::Interned(Box::new(handle.clone()))\n                    }\n                };\n                let deep = matches!(child, Child::Member(idx) if idx == i);\n                Ok(Member {\n                    name: m.name.clone(),\n                    includes,\n                    child,\n                    is_master: m.name == master_ident,\n                    deep,\n                    head: m.head.clone(),\n                })\n            })","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_type_macros/src/parse.rs#L322-L358","documentation":"The type-family derive macro refuses to intern the master member. The master is the plain structural tree through which every other member's conversions walk; interning it would make conversion impossible. The check runs when a member's `ChildRef` is `ChildRef::Interned` and that member's name equals the master ident.","triggerScenarios":"Marking the member whose name equals `master_ident` with the intern attribute (yielding `ChildRef::Interned(handle)`) in a derive input.","commonSituations":"Developers blanket-annotating all members as interned for performance, unaware the master must stay plain.","solutions":["Remove the interning attribute from the master member so it remains the plain tree.","Intern a different (non-master) member instead.","If everything must be interned, redesign the family with a separate plain master."],"exampleFix":"// before\n#[intern]\nmember Master { /* fields */ }\n// after\nmember Master { /* fields, not interned */ }\n#[intern]\nmember Other { /* fields */ }","handlingStrategy":"validation","validationCode":"// before applying intern attributes\nassert!(interned_members.iter().all(|m| m.name != master_ident),\n    \"master member must stay plain\");","typeGuard":"fn is_master(m: &Member, master: &Ident) -> bool { m.name == master }","tryCatchPattern":null,"preventionTips":["Never blanket-apply interning attributes to all members","Mark the master member with a comment noting it must remain plain","Review diffs that add intern attributes for master hits"],"tags":["proc-macro","compile-time","baml","rust"],"backgroundTag":"schema-validation-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}