{"record":{"id":"94e8376b23e4dc2c","repo":"weaviate/weaviate","slug":"adjust-geo-property-type-marshal-geo-property-map","errorCode":null,"errorMessage":"adjust geo property type: marshal geo property map: %w","messagePattern":"adjust geo property type: marshal geo property map: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/shard_geo_props.go","lineNumber":253,"sourceCode":"\t\treturn err\n\t}\n\n\tif obj.Properties() == nil {\n\t\treturn nil\n\t}\n\n\tasMap := obj.Properties().(map[string]interface{})\n\tpropValue, ok := asMap[propName]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tvar asGeo *models.GeoCoordinates\n\tswitch val := propValue.(type) {\n\tcase map[string]any:\n\t\tasGeoBytes, err := json.Marshal(val)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"adjust geo property type: marshal geo property map: %w\", err)\n\t\t}\n\t\tvar asGeoAdjusted models.GeoCoordinates\n\t\terr = json.Unmarshal(asGeoBytes, &asGeoAdjusted)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"adjust geo property type: unmarshal geo property map: %w\", err)\n\t\t}\n\t\tasGeo = &asGeoAdjusted\n\tcase *models.GeoCoordinates:\n\t\tasGeo = val\n\tdefault:\n\t\treturn fmt.Errorf(\"expected prop to be of type %T, but got: %T\",\n\t\t\t&models.GeoCoordinates{}, propValue)\n\t}\n\n\tif s.index.AsyncIndexingEnabled {\n\t\tif geoQueue, ok := s.geoQueues[propName]; ok {\n\t\t\tvec, err := geo.GeoCoordinatesToVector(asGeo)\n\t\t\tif err != nil {","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/shard_geo_props.go#L235-L271","documentation":"Wraps json.Marshal failure when converting a geo property supplied as map[string]any into bytes for decoding into models.GeoCoordinates in addToGeoIndex. The map could not be serialized (e.g. contains unmarshalable values).","triggerScenarios":"A geoCoordinates property value is a map[string]any containing values json.Marshal cannot encode (channels, funcs, cycles, or invalid nested types injected programmatically).","commonSituations":"Objects constructed programmatically via Go client with non-JSON-serializable geo property values; corrupted in-memory data from another path.","solutions":["Send geo properties as {\"latitude\": float64, \"longitude\": float64} with JSON-safe values","Inspect the offending object's geo property value for unmarshalable content","Marshal the map yourself first to validate before submitting"],"exampleFix":"// before\nprop[\"geo\"] = map[string]any{\"lat\": math.Inf(1), \"lng\": 1.0} // Inf is invalid JSON\n// after\nprop[\"geo\"] = map[string]any{\"latitude\": 52.0, \"longitude\": 4.9}","handlingStrategy":"validation","validationCode":"func validGeo(m map[string]any) error {\n  b, err := json.Marshal(m)\n  if err != nil { return err }\n  var g models.GeoCoordinates\n  return json.Unmarshal(b, &g)\n}","typeGuard":null,"tryCatchPattern":"if err := batchImport(objs); err != nil {\n  if strings.Contains(err.Error(), \"marshal geo property map\") {\n    logger.Errorf(\"object geo prop is not JSON-serializable: %v\", err)\n  }\n}","preventionTips":["Use typed GeoCoordinates structs or plain {latitude,longitude} maps","Avoid float NaN/Inf values in geo props","Pre-validate programmatic objects with json.Marshal before import"],"tags":["geo-properties","json","serialization"],"backgroundTag":"json-marshal-failed","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"}