weaviate/weaviate · error
adjust geo property type: marshal geo property map: %w
Error message
adjust geo property type: marshal geo property map: %w
What it means
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).
Source
Thrown at adapters/repos/db/shard_geo_props.go:253
return err
}
if obj.Properties() == nil {
return nil
}
asMap := obj.Properties().(map[string]interface{})
propValue, ok := asMap[propName]
if !ok {
return nil
}
var asGeo *models.GeoCoordinates
switch val := propValue.(type) {
case map[string]any:
asGeoBytes, err := json.Marshal(val)
if err != nil {
return fmt.Errorf("adjust geo property type: marshal geo property map: %w", err)
}
var asGeoAdjusted models.GeoCoordinates
err = json.Unmarshal(asGeoBytes, &asGeoAdjusted)
if err != nil {
return fmt.Errorf("adjust geo property type: unmarshal geo property map: %w", err)
}
asGeo = &asGeoAdjusted
case *models.GeoCoordinates:
asGeo = val
default:
return fmt.Errorf("expected prop to be of type %T, but got: %T",
&models.GeoCoordinates{}, propValue)
}
if s.index.AsyncIndexingEnabled {
if geoQueue, ok := s.geoQueues[propName]; ok {
vec, err := geo.GeoCoordinatesToVector(asGeo)
if err != nil {View on GitHub (pinned to 75aa4b6d11)
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
Example fix
// before
prop["geo"] = map[string]any{"lat": math.Inf(1), "lng": 1.0} // Inf is invalid JSON
// after
prop["geo"] = map[string]any{"latitude": 52.0, "longitude": 4.9} Defensive patterns
Strategy: validation
Validate before calling
func validGeo(m map[string]any) error {
b, err := json.Marshal(m)
if err != nil { return err }
var g models.GeoCoordinates
return json.Unmarshal(b, &g)
} Try / catch
if err := batchImport(objs); err != nil {
if strings.Contains(err.Error(), "marshal geo property map") {
logger.Errorf("object geo prop is not JSON-serializable: %v", err)
}
} Prevention
- 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
When it happens
Trigger: A geoCoordinates property value is a map[string]any containing values json.Marshal cannot encode (channels, funcs, cycles, or invalid nested types injected programmatically).
Common situations: Objects constructed programmatically via Go client with non-JSON-serializable geo property values; corrupted in-memory data from another path.
Understand the failure class
Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.
Related errors
- marshal status request: %w
- marshal abort request: %w
- marshal prepare request: %w
- encode async-checkpoint create body: %w
- encode async-checkpoint delete body: %w
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/94e8376b23e4dc2c.
Report an issue: GitHub.