{"record":{"id":"95cea6d7bfc0517d","repo":"weaviate/weaviate","slug":"element-d-expected-geo-element-to-be-models-geo","errorCode":null,"errorMessage":"element %d: expected geo element to be *models.GeoCoordinates, but got %T","messagePattern":"element (.+?): expected geo element to be \\*models\\.GeoCoordinates, but got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/traverser/grouper/merge_group.go","lineNumber":247,"sourceCode":"\n\t\tif asBool {\n\t\t\tcountTrue++\n\t\t} else {\n\t\t\tcountFalse++\n\t\t}\n\t}\n\n\treturn countTrue >= countFalse, nil\n}\n\nfunc mergeGeoProps(in []interface{}) (*models.GeoCoordinates, error) {\n\tvar sumLat float32\n\tvar sumLon float32\n\n\tfor i, elem := range in {\n\t\tasGeo, ok := elem.(*models.GeoCoordinates)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"element %d: expected geo element to be *models.GeoCoordinates, but got %T\", i, elem)\n\t\t}\n\n\t\tif asGeo.Latitude != nil {\n\t\t\tsumLat += *asGeo.Latitude\n\t\t}\n\t\tif asGeo.Longitude != nil {\n\t\t\tsumLon += *asGeo.Longitude\n\t\t}\n\t}\n\n\treturn &models.GeoCoordinates{\n\t\tLatitude:  ptFloat32(sumLat / float32(len(in))),\n\t\tLongitude: ptFloat32(sumLon / float32(len(in))),\n\t}, nil\n}\n\nfunc ptFloat32(in float32) *float32 {\n\treturn &in","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/traverser/grouper/merge_group.go#L229-L265","documentation":"mergeGeoProps averages latitude/longitude of grouped GeoCoordinates during groupBy. Each element must be *models.GeoCoordinates; other types abort with the index and actual type. nil Latitude/Longitude pointers are skipped in averaging.","triggerScenarios":"A groupBy query over a geoCoordinates property where a grouped element is not *models.GeoCoordinates — e.g. the value decoded as a map[string]interface{} instead of the model struct.","commonSituations":"Grouping on a property that is not actually geoCoordinates in the schema, or older data written in a different geo format that does not deserialize into models.GeoCoordinates.","solutions":["Confirm the property dataType is geoCoordinates and objects store {latitude, longitude} objects","Re-import or migrate objects written in a legacy geo format","Do not groupBy on non-geo properties expecting geo merging","Upgrade Weaviate if a deserialization fix for geo coordinates landed in a newer version"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Validate geo shape before writing\nfunction isGeo(v) {\n  return v && typeof v === 'object' &&\n    typeof v.latitude === 'number' && typeof v.longitude === 'number'\n}","typeGuard":"function isGeoCoordinates(v) {\n  return v !== null && typeof v === 'object' &&\n    'latitude' in v && 'longitude' in v &&\n    typeof v.latitude === 'number' && typeof v.longitude === 'number'\n}","tryCatchPattern":null,"preventionTips":["Store geoCoordinates as {latitude: number, longitude: number} objects","Confirm the property dataType is geoCoordinates before grouping on it","Migrate legacy geo formats (arrays, separate lat/lon props) before grouping","Null latitude/longitude are tolerated in merging but it is best to omit broken geo objects"],"tags":["graphql","groupby","geo","type-mismatch"],"backgroundTag":"unexpected-type-in-group-merge","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"}