weaviate/weaviate · error
element %d: expected geo element to be *models.GeoCoordinate
Error message
element %d: expected geo element to be *models.GeoCoordinates, but got %T
What it means
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.
Source
Thrown at usecases/traverser/grouper/merge_group.go:247
if asBool {
countTrue++
} else {
countFalse++
}
}
return countTrue >= countFalse, nil
}
func mergeGeoProps(in []interface{}) (*models.GeoCoordinates, error) {
var sumLat float32
var sumLon float32
for i, elem := range in {
asGeo, ok := elem.(*models.GeoCoordinates)
if !ok {
return nil, fmt.Errorf("element %d: expected geo element to be *models.GeoCoordinates, but got %T", i, elem)
}
if asGeo.Latitude != nil {
sumLat += *asGeo.Latitude
}
if asGeo.Longitude != nil {
sumLon += *asGeo.Longitude
}
}
return &models.GeoCoordinates{
Latitude: ptFloat32(sumLat / float32(len(in))),
Longitude: ptFloat32(sumLon / float32(len(in))),
}, nil
}
func ptFloat32(in float32) *float32 {
return &inView on GitHub (pinned to 75aa4b6d11)
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
Defensive patterns
Strategy: type-guard
Validate before calling
// Validate geo shape before writing
function isGeo(v) {
return v && typeof v === 'object' &&
typeof v.latitude === 'number' && typeof v.longitude === 'number'
} Type guard
function isGeoCoordinates(v) {
return v !== null && typeof v === 'object' &&
'latitude' in v && 'longitude' in v &&
typeof v.latitude === 'number' && typeof v.longitude === 'number'
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- element %d: expected textual element to be string, but got %
- element %d: expected numerical element to be float64, but go
- element %d: expected boolean element to be bool, but got %T
- element %d: expected reference values to be slice, but got %
- 'nearDepth' invalid parameter
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/95cea6d7bfc0517d.
Report an issue: GitHub.