BoundaryML/baml · error

the master member cannot be interned: the master is the plai

Error message

the master member cannot be interned: the master is the plain tree every other member converts through

What it means

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.

Source

Thrown at baml_language/crates/baml_type_macros/src/parse.rs:340

                    ChildRef::Named(name) => {
                        let idx = member_index(name)?;
                        // A plain member cannot nest an interned member: the
                        // structural conversion walkers would have to convert
                        // through a handle, which only the hand-written
                        // boundary conversions can do.
                        if matches!(members[idx].child, ChildRef::Interned(_)) {
                            return Err(syn::Error::new(
                                name.span(),
                                format!(
                                    "interned member `{name}` cannot be another member's child"
                                ),
                            ));
                        }
                        Child::Member(idx)
                    }
                    ChildRef::Interned(handle) => {
                        if m.name == master_ident {
                            return Err(syn::Error::new(
                                m.name.span(),
                                "the master member cannot be interned: the master is the \
                                 plain tree every other member converts through",
                            ));
                        }
                        Child::Interned(Box::new(handle.clone()))
                    }
                };
                let deep = matches!(child, Child::Member(idx) if idx == i);
                Ok(Member {
                    name: m.name.clone(),
                    includes,
                    child,
                    is_master: m.name == master_ident,
                    deep,
                    head: m.head.clone(),
                })
            })

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Remove the interning attribute from the master member so it remains the plain tree.
  2. Intern a different (non-master) member instead.
  3. If everything must be interned, redesign the family with a separate plain master.

Example fix

// before
#[intern]
member Master { /* fields */ }
// after
member Master { /* fields, not interned */ }
#[intern]
member Other { /* fields */ }
Defensive patterns

Strategy: validation

Validate before calling

// before applying intern attributes
assert!(interned_members.iter().all(|m| m.name != master_ident),
    "master member must stay plain");

Type guard

fn is_master(m: &Member, master: &Ident) -> bool { m.name == master }

Prevention

When it happens

Trigger: Marking the member whose name equals `master_ident` with the intern attribute (yielding `ChildRef::Interned(handle)`) in a derive input.

Common situations: Developers blanket-annotating all members as interned for performance, unaware the master must stay plain.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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