BoundaryML/baml · error

Field/Index stores are handled in emit_statement, not…

Error message

Field/Index stores are handled in emit_statement, not emit_store_place

What it means

Internal compiler invariant in the bytecode emitter: emit_store_place was called with a Field or Index place. Field and index stores are lowered by emit_statement (which knows the object and key operands), so reaching this unreachable! means the place-splitting logic upstream routed a store through the wrong emitter path. It indicates a compiler bug, not a user-source problem.

Solutions

  1. Update to the latest baml compiler — this is an internal emitter bug
  2. Reduce the failing .baml code to a minimal repro (usually a field or index assignment) and report it to the BAML maintainers
  3. As a stopgap, restructure the offending assignment (e.g. via a local variable) to avoid the mis-routed store path
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at baml_language/crates/baml_compiler2_emit/src/emit.rs:2277 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at baml_language/crates/baml_compiler2_emit/src/emit.rs:2277

                            self.emit_store_var(slot);
                        }
                    }
                    LocalStoreBehavior::KeepOnStack => {
                        // PhiLike/ReturnPhi: keep value on stack (no-op) - value goes to join/return.
                        // CallResultImmediate: keep value on stack (no-op) - value used immediately.
                    }
                    LocalStoreBehavior::PopValue => {
                        // Virtual, CopyOf, or Dead local - just pop the value
                        self.emit(Instruction::Pop(1));
                    }
                }
            }
            Place::Capture(idx) => {
                // StoreCapture for lambda body capture stores.
                self.emit(Instruction::StoreCapture(*idx));
            }
            Place::Field { .. } | Place::Index { .. } => {
                unreachable!(
                    "Field/Index stores are handled in emit_statement, not emit_store_place"
                );
            }
        }
    }

    // ========================================================================
    // Terminator Emission
    // ========================================================================

    fn emit_narrow_bind(&mut self, ty_template: &TyTemplate, destination: Local) {
        unwrap_infallible(PullSink::is_type(self, ty_template));
        let last = self
            .bytecode
            .instructions
            .last_mut()
            .expect("is_type emits bytecode");
        if let Instruction::IsType(ty) = *last {

View on GitHub (pinned to bd85ce9dee)