{"id":"273ba9a3bd1bc4f9","repo":"jackc/pgx","slug":"cannot-convert-v-to-integer","errorCode":null,"errorMessage":"cannot convert %v to integer","messagePattern":"cannot convert (.+?) to integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/numeric.go","lineNumber":154,"sourceCode":"\t\tsmallF, _ := bigF.Float64()\n\t\tsrc = strconv.FormatFloat(smallF, 'f', -1, 64)\n\t}\n\n\tnum, exp, err := parseNumericString(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*n = Numeric{Int: num, Exp: exp, Valid: true}\n\n\treturn nil\n}\n\nfunc (n *Numeric) toBigInt() (*big.Int, error) {\n\tif n.NaN {\n\t\treturn nil, fmt.Errorf(\"cannot convert NaN to integer\")\n\t} else if n.InfinityModifier != Finite {\n\t\treturn nil, fmt.Errorf(\"cannot convert %v to integer\", n.InfinityModifier)\n\t}\n\n\tif n.Int == nil {\n\t\treturn big.NewInt(0), nil\n\t}\n\n\tif n.Exp == 0 {\n\t\treturn n.Int, nil\n\t}\n\n\tnum := &big.Int{}\n\tnum.Set(n.Int)\n\tif n.Exp > 0 {\n\t\tmul := &big.Int{}\n\t\tmul.Exp(big10, big.NewInt(int64(n.Exp)), nil)\n\t\tnum.Mul(num, mul)\n\t\treturn num, nil\n\t}","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/numeric.go#L136-L172","documentation":"Error \"cannot convert %v to integer\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/numeric.go:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}