{"record":{"id":"62ff56f991389c6d","repo":"weaviate/weaviate","slug":"filtering-for-integer-but-received-a-non-finite-n","errorCode":null,"errorMessage":"filtering for integer, but received a non-finite number %v","messagePattern":"filtering for integer, but received a non-finite number (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/handlers/grpc/v1/filters.go","lineNumber":389,"sourceCode":"\t\treturn nil, \"\", fmt.Errorf(\"unknown target type %v\", target)\n\t}\n}\n\n// floatToInt safely converts a float64 to int for use as an integer filter\n// value. It rejects NaN, ±Inf, values outside the int64 range, and fractional\n// values. This allows whole-number floats (e.g. 2.0 or \"2.0\") to be accepted\n// as a convenience, while avoiding Go's implementation-defined behavior for\n// out-of-range float→int conversions and silent truncation of fractional\n// values.\n//\n// Note: float64 cannot represent every int64 exactly. Values near the int64\n// boundary that ParseFloat rounds up to float64(math.MaxInt64) = 2^63 are\n// rejected as out of range. Callers that need exact large integers should\n// use the native integer filter value instead of float/text.\nfunc floatToInt(v float64) (int, error) {\n\tswitch {\n\tcase math.IsNaN(v) || math.IsInf(v, 0):\n\t\treturn 0, fmt.Errorf(\"filtering for integer, but received a non-finite number %v\", v)\n\tcase v < float64(math.MinInt64) || v >= float64(math.MaxInt64):\n\t\treturn 0, fmt.Errorf(\"filtering for integer, but received a value out of range %v\", v)\n\tcase math.Trunc(v) != v:\n\t\treturn 0, fmt.Errorf(\"filtering for integer, but received a floating point number %v\", v)\n\t}\n\treturn int(v), nil\n}\n","sourceCodeStart":371,"sourceCodeEnd":397,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/grpc/v1/filters.go#L371-L397","documentation":"Validation error from floatToInt during int-property filter coercion: the numeric value is NaN or ±Inf, which has no integer representation. floatToInt deliberately rejects these rather than relying on Go's implementation-defined float→int conversion, so the filter is refused instead of silently becoming an arbitrary integer.","triggerScenarios":"Thrown at adapters/handlers/grpc/v1/filters.go:389 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a finite integer value","Fix client-side computation that produced NaN/Inf"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}