{"record":{"id":"250d3cfef2e3c131","repo":"swc-project/swc","slug":"unexpected-eof","errorCode":null,"errorMessage":"Unexpected eof","messagePattern":"Unexpected eof","errorType":"validation","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_lexer/src/common/parser/mod.rs","lineNumber":517,"sourceCode":"    let cur = p.input().cur();\n    Ok(if cur.is_shebang() {\n        let ret = p.input_mut().expect_shebang_token_and_bump();\n        Some(ret)\n    } else {\n        None\n    })\n}\n\n#[cold]\n#[inline(never)]\npub fn eof_error<'a, P: Parser<'a>>(p: &mut P) -> crate::error::Error {\n    debug_assert!(\n        p.input().cur().is_eof(),\n        \"Parser should not call throw_eof_error() without knowing current token\"\n    );\n    let pos = p.input().end_pos();\n    let last = Span { lo: pos, hi: pos };\n    crate::error::Error::new(last, crate::error::SyntaxError::Eof)\n}\n","sourceCodeStart":499,"sourceCodeEnd":519,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_lexer/src/common/parser/mod.rs#L499-L519","documentation":"Eof sentinel built by the shared eof_error helper when the parser, at a point where a token is required (literal, JSX element, export, for-head, TS modifier/decl), sees the EOF token. The span is a zero-width Span at the end position, pointing just past the last character.","triggerScenarios":"Thrown at crates/swc_ecma_lexer/src/common/parser/mod.rs:517 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Complete the truncated construct the parser was in the middle of (check the reported call path for which production needed a token)","Check for unbalanced braces/brackets that swallowed the rest of the file"],"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-14T00:17:10.932Z"}