{"record":{"id":"f28e8e91c14d78f7","repo":"BoundaryML/baml","slug":"field-index-stores-are-handled-in-emit-statement-not-emit","errorCode":null,"errorMessage":"Field/Index stores are handled in emit_statement, not emit_store_place","messagePattern":"Field/Index stores are handled in emit_statement, not emit_store_place","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_compiler2_emit/src/emit.rs","lineNumber":2277,"sourceCode":"                            self.emit_store_var(slot);\n                        }\n                    }\n                    LocalStoreBehavior::KeepOnStack => {\n                        // PhiLike/ReturnPhi: keep value on stack (no-op) - value goes to join/return.\n                        // CallResultImmediate: keep value on stack (no-op) - value used immediately.\n                    }\n                    LocalStoreBehavior::PopValue => {\n                        // Virtual, CopyOf, or Dead local - just pop the value\n                        self.emit(Instruction::Pop(1));\n                    }\n                }\n            }\n            Place::Capture(idx) => {\n                // StoreCapture for lambda body capture stores.\n                self.emit(Instruction::StoreCapture(*idx));\n            }\n            Place::Field { .. } | Place::Index { .. } => {\n                unreachable!(\n                    \"Field/Index stores are handled in emit_statement, not emit_store_place\"\n                );\n            }\n        }\n    }\n\n    // ========================================================================\n    // Terminator Emission\n    // ========================================================================\n\n    fn emit_narrow_bind(&mut self, ty_template: &TyTemplate, destination: Local) {\n        unwrap_infallible(PullSink::is_type(self, ty_template));\n        let last = self\n            .bytecode\n            .instructions\n            .last_mut()\n            .expect(\"is_type emits bytecode\");\n        if let Instruction::IsType(ty) = *last {","sourceCodeStart":2259,"sourceCodeEnd":2295,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_compiler2_emit/src/emit.rs#L2259-L2295","documentation":"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.","triggerScenarios":"Thrown at baml_language/crates/baml_compiler2_emit/src/emit.rs:2277 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Update to the latest baml compiler — this is an internal emitter bug","Reduce the failing .baml code to a minimal repro (usually a field or index assignment) and report it to the BAML maintainers","As a stopgap, restructure the offending assignment (e.g. via a local variable) to avoid the mis-routed store path"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}