{"record":{"id":"67e0c0f6638a4738","repo":"BoundaryML/baml","slug":"interface-frame-starts-with-self","errorCode":null,"errorMessage":"interface frame starts with Self","messagePattern":"interface frame starts with Self","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_compiler2_emit/src/lib.rs","lineNumber":800,"sourceCode":"            let iface_tn = spelling.wire(&qualify_def(\n                db,\n                Definition::Interface(iface_loc),\n                &iface_data.name,\n            ));\n            if !iface_data.fields.is_empty() {\n                iface_field_decls\n                    .entry(iface_tn.clone())\n                    .or_insert_with(|| iface_data.fields.iter().map(|f| f.name.clone()).collect());\n            }\n            if !iface_data.associated_types.is_empty() {\n                iface_assoc_decls\n                    .entry(iface_tn.clone())\n                    .or_insert_with(|| {\n                        let frame_params =\n                            baml_compiler2_hir_ty::lower::interface_frame(db, iface_loc);\n                        let self_param = frame_params\n                            .first()\n                            .expect(\"interface frame starts with Self\")\n                            .clone();\n                        (\n                            self_param,\n                            baml_compiler2_hir_ty::lower::interface_declared_params(db, iface_loc),\n                            iface_data\n                                .associated_types\n                                .iter()\n                                .map(|assoc| {\n                                    (\n                                        assoc.name.clone(),\n                                        baml_compiler2_hir_ty::interfaces::\n                                            interface_associated_type_default(\n                                                db,\n                                                iface_loc,\n                                                assoc.name.clone(),\n                                            )\n                                            .map(|(ty, _decl_site_diags)| ty),\n                                    )","sourceCodeStart":782,"sourceCodeEnd":818,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_compiler2_emit/src/lib.rs#L782-L818","documentation":"While building packages, the compiler fetches an interface's frame parameters via `lower::interface_frame` and `.expect`s that the first parameter is `Self`. The panic means `interface_frame` returned an empty parameter list (or a list not starting with Self), so the interface lacks its implicit Self parameter.","triggerScenarios":"Calling `build_packages` on an interface whose HIR frame has no leading Self parameter — e.g., the interface was built by a lowering pass that dropped the Self parameter, or the lookup `iface_loc` points at the wrong declaration node.","commonSituations":"Regressions in the HIR lowering for interfaces; malformed or hand-edited intermediate representations; resolving an interface location from a stale/cached index.","solutions":["Fix the lowering pass so `interface_frame` always yields Self as the first parameter","Verify `iface_loc` refers to the correct interface declaration (not a stale or wrong node)","Clear incremental/cached HIR data and rebuild","Add a defensive error path reporting which interface lacks Self instead of panicking"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let frame_params = lower::interface_frame(db, iface_loc);\nif frame_params.first().map(|p| p.is_self()) != Some(true) {\n    return Err(CompilerBug::InterfaceMissingSelf(iface_tn.clone()));\n}","typeGuard":"fn frame_starts_with_self(params: &[Param]) -> bool {\n    params.first().map(|p| p.is_self()).unwrap_or(false)\n}","tryCatchPattern":"std::panic::catch_unwind(|| build_packages(db))\n    .unwrap_or_else(|_| report_compiler_bug(\"interface frame missing Self\"));","preventionTips":["Ensure the interface lowering pass always inserts Self as the first frame parameter","Validate iface_loc resolution against the current HIR, not cached indices","Add a lowering round-trip test asserting Self presence for every interface fixture"],"tags":["compiler","rust","panic","interfaces","self-parameter"],"backgroundTag":"internal-invariant-violation","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"}