{"record":{"id":"c98381a4cfe5b1e2","repo":"oxc-project/oxc","slug":"hirbuilder-expected-block-to-exist","errorCode":null,"errorMessage":"[HIRBuilder] expected block {:?} to exist","messagePattern":"\\[HIRBuilder\\] expected block (.+?) to exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_react_compiler/src/react_compiler_lowering/hir_builder.rs","lineNumber":935,"sourceCode":"        visited: &mut FxHashSet<BlockId>,\n        used: &mut FxHashSet<BlockId>,\n        used_fallthroughs: &mut FxHashSet<BlockId>,\n        postorder: &mut Vec<BlockId>,\n    ) {\n        let was_used = used.contains(&block_id);\n        let was_visited = visited.contains(&block_id);\n        visited.insert(block_id);\n        if is_used {\n            used.insert(block_id);\n        }\n        if was_visited && (was_used || !is_used) {\n            return;\n        }\n\n        let block = hir\n            .blocks\n            .get(&block_id)\n            .unwrap_or_else(|| panic!(\"[HIRBuilder] expected block {:?} to exist\", block_id));\n\n        // Visit successors in reverse order so that when we reverse the\n        // postorder list, sibling edges come out in program order.\n        let mut successors = each_terminal_successor(&block.terminal);\n        successors.reverse();\n\n        let fallthrough = terminal_fallthrough(&block.terminal);\n\n        // Visit fallthrough first (marking as not-yet-used) to ensure its\n        // block ID is emitted in the correct position.\n        if let Some(ft) = fallthrough {\n            if is_used {\n                used_fallthroughs.insert(ft);\n            }\n            visit(hir, ft, false, visited, used, used_fallthroughs, postorder);\n        }\n        for successor in successors {\n            visit(hir, successor, is_used, visited, used, used_fallthroughs, postorder);","sourceCodeStart":917,"sourceCodeEnd":953,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_react_compiler/src/react_compiler_lowering/hir_builder.rs#L917-L953","documentation":"Diagnostic from oxlint's vue/valid-define-emits rule (crates/oxc_linter/src/rules/vue/valid_define_emits.rs). `defineEmits` is a compiler macro and may be called exactly once per `<script setup>` block; a second call is reported with both call sites labeled. Only the first call's result is wired to the component by the compiler, so events declared in later calls silently don't exist.","triggerScenarios":"Two or more `defineEmits(...)` calls in the same `<script setup>` block — e.g. `defineEmits({ notify: null }); defineEmits({ submit: null });`. The rule records the first call's span and reports every subsequent call alongside it.","commonSituations":"Merging components or copy-pasting blocks; appending a new `defineEmits` when adding events instead of extending the existing call.","solutions":["Merge all events into a single call: `defineEmits({ notify: null, submit: null })` (or one union of call signatures in TS).","Delete the leftover call after merging.","Assign once — `const emit = defineEmits([...])` — and reuse `emit` everywhere."],"exampleFix":"// before\nconst emitA = defineEmits(['notify']);\nconst emitB = defineEmits(['submit']);\n\n// after\nconst emit = defineEmits(['notify', 'submit']);","handlingStrategy":"validation","validationCode":"// only one defineEmits call per <script setup>\nconst count = (setupSource.match(/\\bdefineEmits\\s*\\(?/g) || []).length;\nif (count > 1) throw new Error(`defineEmits called ${count} times; merge the declarations`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create a single `const emit = defineEmits(...)` at the top of the setup block and reuse it.","When adding events, extend the existing declaration instead of appending a new call.","Search for `defineEmits` before merging or copy-pasting setup code."],"tags":["vue","oxlint","lint","script-setup","defineemits","compiler-macro"],"backgroundTag":"vue-define-emits-misuse","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}