{"record":{"id":"8c0e9cb769ebc545","repo":"hasura/graphql-engine","slug":"lookahead-of-a-number-cannot-be-a-namestart-0","errorCode":null,"errorMessage":"lookahead of a number cannot be a 'NameStart': {0:?}","messagePattern":"lookahead of a number cannot be a 'NameStart': (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/lexer/number.rs","lineNumber":30,"sourceCode":"    Int64(i64),\n}\n\nimpl Display for NumberToken {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        match self {\n            NumberToken::Float64(float) => float.fmt(f),\n            NumberToken::Int64(i) => i.fmt(f),\n        }\n    }\n}\n\n#[derive(Error, Debug, PartialEq, Eq, Clone)]\npub enum Error {\n    #[error(\"expected a digit, but found: {found:?}\")]\n    DigitExpected { found: Option<u8> },\n    #[error(\"failed to parse a number: {error:?}\")]\n    LexicalError { error: lexical_core::Error },\n    #[error(\"lookahead of a number cannot be a 'NameStart': {0:?}\")]\n    NameStart(u8),\n}\n\npub fn parse_number(bytes: &[u8]) -> Result<(NumberToken, usize), Error> {\n    let number_start = 0;\n    let mut ix = 0;\n    // Parse the optional negative sign\n    if let Some(&b'-') = bytes.get(ix) {\n        ix += 1;\n    }\n    // Count the number of integers present, until you hit a non-digit.\n    // This helps to distinguish between integers and floats\n    let integer_count = bytes[ix..]\n        .iter()\n        .take_while(|&&b| b.is_ascii_digit())\n        .count();\n    if integer_count == 0 {\n        return Err(Error::DigitExpected {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/lexer/number.rs#L12-L48","documentation":"Lexer error raised when the character immediately following a number token is a GraphQL 'NameStart' character (letter or underscore). GraphQL requires number tokens to be delimited, so '123abc' is ambiguous/illegal and rejected by parse_number's lookahead check.","triggerScenarios":"Query text like '123abc', '0x1F', or a number immediately followed by a name with no separator; missing whitespace/operator between a number and an identifier.","commonSituations":"Broken string interpolation joining a number to the next token; typos such as units attached to numbers ('10px'); minification bugs removing whitespace.","solutions":["Insert a space/operator between the number and the following identifier","Use variables for numeric values instead of inline literals","Fix the client-side query template producing the concatenated token"],"exampleFix":"# before\n{ users(limit:10and...) }\n# after\n{ users(limit: 10, ...) }","handlingStrategy":"validation","validationCode":"// Reject a digit immediately followed by a name char\nif (/\\d[_A-Za-z]/.test(queryText)) throw new Error('number glued to identifier');","typeGuard":"const hasGluedNumberToken = (q) => /\\d[_A-Za-z]/.test(q);","tryCatchPattern":"// Catch, report the byte offset from the lexer error, and insert separators","preventionTips":["Put whitespace after inline numbers","Use variables to avoid literal/identifier adjacency"],"tags":["graphql","lexer","number","token-boundary"],"backgroundTag":"graphql-number-lex-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}