{"record":{"id":"d012a193d29b5c37","repo":"gohugoio/hugo","slug":"illegal-number-syntax-q","errorCode":null,"errorMessage":"illegal number syntax: %q","messagePattern":"illegal number syntax: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/internal/go_templates/texttemplate/parse/node.go","lineNumber":714,"sourceCode":"\t\t\t// it's a huge number too large to fit in an int. Reject it.\n\t\t\tif !strings.ContainsAny(text, \".eEpP\") {\n\t\t\t\treturn nil, fmt.Errorf(\"integer overflow: %q\", text)\n\t\t\t}\n\t\t\tn.IsFloat = true\n\t\t\tn.Float64 = f\n\t\t\t// If a floating-point extraction succeeded, extract the int if needed.\n\t\t\tif !n.IsInt && float64(int64(f)) == f {\n\t\t\t\tn.IsInt = true\n\t\t\t\tn.Int64 = int64(f)\n\t\t\t}\n\t\t\tif !n.IsUint && float64(uint64(f)) == f {\n\t\t\t\tn.IsUint = true\n\t\t\t\tn.Uint64 = uint64(f)\n\t\t\t}\n\t\t}\n\t}\n\tif !n.IsInt && !n.IsUint && !n.IsFloat {\n\t\treturn nil, fmt.Errorf(\"illegal number syntax: %q\", text)\n\t}\n\treturn n, nil\n}\n\n// simplifyComplex pulls out any other types that are represented by the complex number.\n// These all require that the imaginary part be zero.\nfunc (n *NumberNode) simplifyComplex() {\n\tn.IsFloat = imag(n.Complex128) == 0\n\tif n.IsFloat {\n\t\tn.Float64 = real(n.Complex128)\n\t\tn.IsInt = float64(int64(n.Float64)) == n.Float64\n\t\tif n.IsInt {\n\t\t\tn.Int64 = int64(n.Float64)\n\t\t}\n\t\tn.IsUint = float64(uint64(n.Float64)) == n.Float64\n\t\tif n.IsUint {\n\t\t\tn.Uint64 = uint64(n.Float64)\n\t\t}","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/internal/go_templates/texttemplate/parse/node.go#L696-L732","documentation":"The template numeric literal could not be parsed as int, uint, or float - none of the parse paths succeeded, so newNumber returns illegal number syntax. See node.go:713-715.","triggerScenarios":"Malformed literals such as {{ 0xZZ }}, {{ 1..2 }}, {{ 0b2 }}, or locale-formatted numbers with commas like {{ 1,000 }}.","commonSituations":"Typo in a numeric literal; copy-pasting locale-formatted numbers; stray punctuation inside an action; attempting unsupported base prefixes.","solutions":["Correct the numeric literal to valid Go constant syntax.","Remove stray characters and fix decimal/thousand separators.","Wrap intended non-numeric text in quotes so it is not parsed as a number."],"exampleFix":"// before\n{{ 1,000 }}\n\n// after\n{{ 1000 }}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"treeSet, err := parse.Parse(name, text, left, right, funcs)\nif err != nil {\n    // err already formatted as template: name:line: msg\n    return err\n}","preventionTips":["Treat the file:line in the formatted message as the authoritative pointer to the real defect.","Fix the underlying specific error described after the line number rather than the wrapper text."],"tags":["template","go","parse","syntax","numeric"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}