{"record":{"id":"94c3e1a6ef9849a9","repo":"swc-project/swc","slug":"invalid-unicode-escape","errorCode":null,"errorMessage":"Invalid unicode escape","messagePattern":"Invalid unicode escape","errorType":"validation","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_lexer/src/common/lexer/mod.rs","lineNumber":867,"sourceCode":"        };\n        Ok(Either::Left((val, raw_str.into())))\n    }\n\n    fn read_int_u32<const RADIX: u8>(&mut self, len: u8) -> LexResult<Option<u32>> {\n        let start = self.state().start();\n\n        let mut count = 0;\n        let v = self.read_digits::<_, Option<u32>, RADIX>(\n            |opt: Option<u32>, radix, val| {\n                count += 1;\n\n                let total = opt\n                    .unwrap_or_default()\n                    .checked_mul(radix as u32)\n                    .and_then(|v| v.checked_add(val))\n                    .ok_or_else(|| {\n                        let span = Span::new_with_checked(start, start);\n                        crate::error::Error::new(span, SyntaxError::InvalidUnicodeEscape)\n                    })?;\n\n                Ok((Some(total), count != len))\n            },\n            true,\n            &mut false,\n        )?;\n        if len != 0 && count != len {\n            Ok(None)\n        } else {\n            Ok(v)\n        }\n    }\n\n    /// Returns `Left(value)` or `Right(BigInt)`\n    fn read_radix_number<const RADIX: u8>(\n        &mut self,\n    ) -> LexResult<Either<(f64, Atom), (Box<BigIntValue>, Atom)>> {","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_lexer/src/common/lexer/mod.rs#L849-L885","documentation":"Lexing error raised inside read_int_u32 while accumulating digits of an integer literal: the running value overflows u32 (checked_mul/checked_add fail) and the closure returns an error spanned from the literal's start. It indicates the numeric literal in the source cannot be represented in 32 bits.","triggerScenarios":"Thrown at crates/swc_ecma_lexer/src/common/lexer/mod.rs:867 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the source so the numeric literal fits in a u32 (or drop the u32-specific parse path)","Ensure the correct radix/scanner path is used for literals that may exceed u32"],"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"}