{"record":{"id":"0eeaa45ba772217c","repo":"swc-project/swc","slug":"label-label-is-already-declared-0eeaa4","errorCode":null,"errorMessage":"Label {label} is already declared","messagePattern":"Label (.+?) is already declared","errorType":"exception","errorClass":"swc_ecma_parser::error::Error","httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_parser/src/parser/stmt.rs","lineNumber":868,"sourceCode":"        expect!(self, Token::RParen);\n\n        // We *may* eat semicolon.\n        let _ = self.eat_general_semi();\n\n        let span = self.span(start);\n\n        Ok(DoWhileStmt { span, test, body }.into())\n    }\n\n    fn parse_labelled_stmt(&mut self, l: Ident) -> PResult<Stmt> {\n        self.do_inside_of_context(Context::IsBreakAllowed, |p| {\n            p.do_outside_of_context(Context::AllowUsingDecl, |p| {\n                let start = l.span.lo();\n\n                let mut errors = Vec::new();\n                for lb in &p.state().labels {\n                    if l.sym == *lb {\n                        errors.push(Error::new(\n                            l.span,\n                            SyntaxError::DuplicateLabel(l.sym.clone()),\n                        ));\n                    }\n                }\n                p.state_mut().labels.push(l.sym.clone());\n\n                let body = Box::new(if p.input().is(Token::Function) {\n                    let f = p.parse_fn_decl(Vec::new())?;\n                    if let Decl::Fn(FnDecl { function, .. }) = &f {\n                        if p.ctx().contains(Context::Strict) {\n                            p.emit_err(function.span, SyntaxError::LabelledFunctionInStrict)\n                        }\n                        if function.is_generator || function.is_async {\n                            p.emit_err(function.span, SyntaxError::LabelledGeneratorOrAsync)\n                        }\n                    }\n","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_parser/src/parser/stmt.rs#L850-L886","documentation":"Parser error from parse_labelled_stmt: the new label's symbol matches one already present in parser.state().labels, i.e. the same label name is declared again in the current label scope (duplicate or shadowing label within nested labelled statements).","triggerScenarios":"Thrown at crates/swc_ecma_parser/src/parser/stmt.rs:868 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a distinct label name","Drop the duplicate labelled statement"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}