{"record":{"id":"8f8fb17cabcfc736","repo":"hasura/graphql-engine","slug":"invalid-number-literal-found-0","errorCode":null,"errorMessage":"invalid number literal found: {0:?}","messagePattern":"invalid number literal found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/lexer.rs","lineNumber":155,"sourceCode":"    ///\n    /// Unexpected characters are characters that _do_ exist in the GraphQL\n    /// language, but is not expected at the current position in the document.\n    #[error(\"unexpected character in the document: {0:?}\")]\n    UnexpectedCharacter(char),\n\n    /// The input source was unexpectedly terminated\n    ///\n    /// Emitted when the current token requires a succeeding character, but\n    /// the source has reached EOF. Emitted when scanning e.g. `\"1.\"`.\n    #[error(\"end of file reached when expecting further input\")]\n    UnexpectedEndOfFile,\n\n    /// An invalid string literal was found\n    #[error(\"invalid string literal found: {0:?}\")]\n    InvalidString(string::Error),\n\n    /// An invalid number literal was found\n    #[error(\"invalid number literal found: {0:?}\")]\n    InvalidNumber(number::Error),\n\n    // An invalid graphql name\n    #[error(\"invalid graphql name: {0}\")]\n    InvalidGraphQlName(String),\n}\n\nimpl From<ast::common::InvalidGraphQlName> for Error {\n    fn from(error: ast::common::InvalidGraphQlName) -> Self {\n        Error::InvalidGraphQlName(error.0)\n    }\n}\n\npub type Result = core::result::Result<Spanning<Token>, Positioned<Error>>;\n\n#[inline]\nfn consume_ascii_chars<F>(data: &[u8], mut f: F) -> usize\nwhere","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/lexer.rs#L137-L173","documentation":"Wrapper error: the lexer's number sub-scanner (number::Error) failed while scanning a numeric literal, e.g. \"1e\" without exponent digits, \"..2\", or a stray '.'.","triggerScenarios":"Lexing documents containing malformed numbers: missing exponent digits, double dots, invalid characters after a sign, per the number::Error variants.","commonSituations":"Formatting numbers with locale-specific separators, broken string interpolation of floats, or hand-typed queries with typos.","solutions":["Inspect the inner number::Error detail at the reported position","Correct the literal (exponent digits, single decimal point)","Render numbers with a GraphQL-safe formatter rather than locale formatting"],"exampleFix":"# before\n{ stats(value: 1e) { id } }\n# after\n{ stats(value: 1e0) { id } }","handlingStrategy":"validation","validationCode":"// validate numeric literals in generated queries\nfn graphql_number_ok(n: &str) -> bool {\n    n.parse::<f64>().is_ok() && !n.contains(\",\") && !n.contains('..') && !n.ends_with(['.', 'e', 'E'])\n}","typeGuard":null,"tryCatchPattern":"On InvalidNumber(inner), surface the inner number::Error and byte position to the query author.","preventionTips":["Format numbers with Rust's Display for f64, never locale formatting","Pass numeric values as variables"],"tags":["graphql","lexer","number-literal","parsing"],"backgroundTag":"graphql-syntax-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}