BoundaryML/baml · error
unknown family member `{name}`
Error message
unknown family member `{name}` What it means
In the same macro parser (from_input), family member references are resolved by name against the declared members. An ident that matches no declared member produces a compile-time syn::Error spanned on that ident.
Source
Thrown at baml_language/crates/baml_type_macros/src/parse.rs:305
}
impl Family {
pub(crate) fn from_input(input: FamilyInput) -> syn::Result<Self> {
let FamilyInput {
axes,
members,
satellites,
master,
} = input;
let axis_index = |name: &Ident| -> syn::Result<usize> {
axes.iter()
.position(|a| a == name)
.ok_or_else(|| syn::Error::new(name.span(), format!("unknown axis `{name}`")))
};
let member_index = |name: &Ident| -> syn::Result<usize> {
members.iter().position(|m| &m.name == name).ok_or_else(|| {
syn::Error::new(name.span(), format!("unknown family member `{name}`"))
})
};
let master_ident = master.ident.clone();
let resolved_members = members
.iter()
.enumerate()
.map(|(i, m)| {
let includes = m
.includes
.iter()
.map(&axis_index)
.collect::<syn::Result<Vec<_>>>()?;
let child = match &m.child {
ChildRef::SelfRef => Child::Member(i),
ChildRef::Named(name) => {
let idx = member_index(name)?;View on GitHub (pinned to bd85ce9dee)
Solutions
- Correct the member name in the macro invocation to match a declared member
- Inspect the family definition's members list for valid names
- If a member was renamed, update every macro call site referencing the old name
Example fix
// before member: ChatMesage, // after member: ChatMessage,
Defensive patterns
Strategy: type-guard
Type guard
fn known_member(name: &str, members: &[Member]) -> Option<usize> {
members.iter().position(|m| m.name == name)
} Try / catch
// Compile-time error; fix the source. To surface a friendlier message in build scripts:
match known_member("ChatMessage", &members) {
Some(_) => {}
None => panic!("member `ChatMessage` not declared; available: {:?}", members.iter().map(|m| &m.name).collect::<Vec<_>>()),
} Prevention
- Copy member names from the family declaration rather than typing them
- After renaming a member, grep for the old name across macro invocations
- Keep family member lists and their macro usages in the same module where possible
When it happens
Trigger: Expanding the macro with input referencing a family member name not present in the members declaration — misspelling, or referencing a member deleted/renamed in the family definition.
Common situations: Typos in member names within macro invocations; adding a member to the invocation but not the family (or removing it from the family but not call sites); copy-paste from a different type family.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- unknown axis `{name}`
- interned member `{name}` cannot be another member's child
- the master member cannot be interned: the master is the plai
- variant `{}` has more than one `#[axis(..)]`
- variant `{}` must declare exactly one `#[axis(..)]`
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/fe93305ff09d60cb.
Report an issue: GitHub.