{"record":{"id":"af8677738425fb55","repo":"weaviate/weaviate","slug":"expected-float64-got-t","errorCode":null,"errorMessage":"expected float64, got %T","messagePattern":"expected float64, got %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/inverted/objects.go","lineNumber":398,"sourceCode":"\tswitch dt {\n\tcase schema.DataTypeText:\n\t\tasString, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected string, got %T\", value)\n\t\t}\n\t\treturn a.Text(tokenization, asString, propName, textAnalyzer), nil\n\n\tcase schema.DataTypeInt:\n\t\tasInt, err := toInt64(value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn a.Int(asInt)\n\n\tcase schema.DataTypeNumber:\n\t\tasFloat, ok := value.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected float64, got %T\", value)\n\t\t}\n\t\treturn a.Float(asFloat)\n\n\tcase schema.DataTypeBoolean:\n\t\tasBool, ok := value.(bool)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected bool, got %T\", value)\n\t\t}\n\t\treturn a.Bool(asBool)\n\n\tcase schema.DataTypeDate:\n\t\tasInt, err := dateToInt64(value)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn a.Int(asInt)\n\n\tcase schema.DataTypeUUID:","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/inverted/objects.go#L380-L416","documentation":"For DataTypeNumber, analyzeValue requires the value to be float64 — the type encoding/json produces for all JSON numbers. Numbers sent as strings, integers wrapped in other Go types from programmatic map construction, or bools trigger this error. Weaviate does not silently coerce, because indexing a wrong-typed value corrupts filterable range statistics.","triggerScenarios":"{\"price\":\"19.99\"} (string) for a number property; Go callers inserting a value as int/float32/`json.Number` directly into the map instead of letting JSON decoding produce float64; null or object values on a number property.","commonSituations":"Go code building maps by hand with typed values (int, float32); APIs/ETL tools sending numbers as strings; config/UI forms submitting quoted numbers; schema migrated from text to number with old string data.","solutions":["Send an unquoted JSON number: {\"price\":19.99}.","In Go, store numbers as float64 in the input map (or route through JSON marshal/unmarshal).","If numbers must remain strings, keep dataType as text and use text filtering instead.","Re-import objects after fixing the client serializer."],"exampleFix":"// before\n{\"price\": \"19.99\"}\n// after\n{\"price\": 19.99}","handlingStrategy":"type-guard","validationCode":"if is_number_prop(props, name) and not isinstance(val, (int, float)) or isinstance(val, bool):\n    raise ValueError(f\"{name} is number and must be a JSON number, not a string\")","typeGuard":"func isFloat64(v any) bool {\n    _, ok := v.(float64)\n    return ok\n}","tryCatchPattern":"err := creator.WithProperties(props).Do(ctx)\nif err != nil && strings.Contains(err.Error(), \"expected float64, got\") {\n    log.Fatalf(\"number property must be an unquoted JSON number: %v\", err)\n}","preventionTips":["Never quote numeric values in JSON payloads.","In Go, store numbers as float64 in hand-built maps (json decoding yields float64).","Fix ETL/form serializers that stringify numbers.","Re-import data after changing a property from text to number."],"tags":["go","weaviate","type-mismatch","numeric"],"backgroundTag":"property-type-mismatch","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"}