{"record":{"id":"24b269ed31489fec","repo":"gleam-lang/gleam","slug":"radix-not-implemented-other","errorCode":null,"errorMessage":"Radix not implemented: {other}","messagePattern":"Radix not implemented: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler-core/src/parse/lexer.rs","lineNumber":1248,"sourceCode":"\n        loop {\n            if Lexer::is_digit_of_radix(self.char0, radix) {\n                let _ = self.next_char().expect(\"radix_run digit\");\n            } else if self.char0 == Some('_') && Lexer::is_digit_of_radix(self.char1, radix) {\n                let _ = self.next_char();\n            } else {\n                break;\n            }\n        }\n\n        &self.source[start..self.get_position() as usize]\n    }\n\n    // Test if a digit is of a certain radix.\n    fn is_digit_of_radix(c: Option<char>, radix: u32) -> bool {\n        match radix {\n            2 | 8 | 10 | 16 => c.filter(|c| c.is_digit(radix)).is_some(),\n            other => panic!(\"Radix not implemented: {other}\"),\n        }\n    }\n\n    // There are 3 kinds of comments\n    // 2 slash, normal\n    // 3 slash, document\n    // 4 slash, module\n    // this function is entered after 2 slashes\n    fn lex_comment(&mut self) -> Spanned {\n        enum Kind {\n            Comment,\n            Doc,\n            ModuleDoc,\n        }\n        let kind = match (self.char0, self.char1) {\n            (Some('/'), Some('/')) => {\n                let _ = self.next_char();\n                let _ = self.next_char();","sourceCodeStart":1230,"sourceCodeEnd":1266,"githubUrl":"https://github.com/gleam-lang/gleam/blob/49f8762da595eb3c8f576656a4200a142ca188c9/compiler-core/src/parse/lexer.rs#L1230-L1266","documentation":"An internal lexer panic in Gleam: `is_digit_of_radix` (compiler-core/src/parse/lexer.rs) only supports radices 2, 8, 10, and 16 for numeric literal scanning, and panics on any other radix value. It signals a programmer error — a caller passed an unsupported radix, likely after a lexer change adding a new numeric literal form.","triggerScenarios":"Calling `is_digit_of_radix(c, radix)` with any `radix` other than 2, 8, 10, or 16 while lexing a numeric literal (e.g. a new literal prefix wired with radix 3 or 0).","commonSituations":"Hit by lexer contributors experimenting with new number literal syntax, or by fuzzers mutating radix arguments. End users cannot choose the radix, so normal compilation never triggers it.","solutions":["Fix the call site to pass only a supported radix (2, 8, 10, 16) for the literal being lexed.","If a new radix is genuinely needed, add it to the `match radix` arm list instead of panicking.","Report the panic with the input file if encountered in an unmodified Gleam build."],"exampleFix":"// before\nmatch radix {\n    2 | 8 | 10 | 16 => c.filter(|c| c.is_digit(radix)).is_some(),\n    other => panic!(\"Radix not implemented: {other}\"),\n}\n// after\nmatch radix {\n    2 | 8 | 10 | 16 => c.filter(|c| c.is_digit(radix)).is_some(),\n    other => unreachable!(\"radix {other} should have been rejected by the literal prefix parser\"),\n}","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"fn is_supported_radix(r: u32) -> bool { matches!(r, 2 | 8 | 10 | 16) }","tryCatchPattern":"// Panics abort the lexer; guard the radix before calling is_digit_of_radix.\nif !matches!(radix, 2 | 8 | 10 | 16) { return Err(LexicalError::UnsupportedRadix(radix)); }","preventionTips":["Pass radices only from the fixed set tied to literal prefixes (0b/0o/0x/decimal).","Prefer returning a lexical error over panicking when adding new literal forms.","Run lexer fuzz tests when touching numeric literal handling."],"tags":["rust","lexer","panic","numeric-literals"],"backgroundTag":"unsupported-operation","analyzedSha":"49f8762da595eb3c8f576656a4200a142ca188c9","analyzedAt":"2026-09-14T11:14:59.388Z","contentChangedAt":"2026-09-14T11:14:59.388Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}