weaviate/weaviate · error
expected previous schema to be map, but got %#v
Error message
expected previous schema to be map, but got %#v
What it means
mergeObjectSchemaAndVectorize type-asserts the previous object's PropertySchema to map[string]interface{} before merging new properties. If the stored property schema came back as a different concrete type (e.g. a non-map PropertySchema variant), the assertion fails and this error is returned. It indicates internal state that violates the merge code's expectation rather than a user-input problem.
Source
Thrown at usecases/objects/merge.go:238
return fmt.Errorf("empty uuid")
}
return nil
}
func (m *Manager) mergeObjectSchemaAndVectorize(ctx context.Context, prevPropsSch models.PropertySchema,
nextProps map[string]interface{}, prevVec, nextVec []float32, prevVecs models.Vectors, nextVecs models.Vectors,
id strfmt.UUID, class *models.Class,
) (*models.Object, error) {
var mergedProps map[string]interface{}
vector := nextVec
vectors := nextVecs
if prevPropsSch == nil {
mergedProps = nextProps
} else {
prevProps, ok := prevPropsSch.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("expected previous schema to be map, but got %#v", prevPropsSch)
}
mergedProps = map[string]interface{}{}
for propName, propValue := range prevProps {
mergedProps[propName] = propValue
}
for propName, propValue := range nextProps {
mergedProps[propName] = propValue
}
}
// Note: vector could be a nil vector in case a vectorizer is configured,
// then the vectorizer will set it
obj := &models.Object{Class: class.Class, Properties: mergedProps, Vector: vector, Vectors: vectors, ID: id}
if err := m.modulesProvider.UpdateVector(ctx, obj, class, m.findObject, m.logger); err != nil {
return nil, err
}
View on GitHub (pinned to 75aa4b6d11)
Solutions
- Inspect the affected object's stored properties (GET the object) to see if properties are malformed
- Re-write the object with a full PUT (replace) so its property schema is re-encoded as a standard map
- Check whether the object came from a backup or migration from an incompatible version; re-export/re-import with the current version
- If reproducible on stock data, file a bug with the object/schema shapes — this should be unreachable for normal writes
Example fix
// before (test/injected prevPropsSch of wrong type)
prev := []interface{}{"not-a-map"}
// after
prev := map[string]interface{}{"name": "existing"} Defensive patterns
Strategy: fallback
Validate before calling
// caller-side sanity check on a fetched object
if _, ok := obj.Properties.(map[string]interface{}); !ok && obj.Properties != nil {
return errors.New("stored properties are not a map; object may be corrupt")
} Type guard
func propsAreMap(p models.PropertySchema) bool {
_, ok := p.(map[string]interface{})
return ok
} Try / catch
if err != nil {
var e *objects.Error
if errors.As(err, &e) && strings.Contains(e.Error(), "expected previous schema to be map") {
// fall back to full PUT replace of the object
}
} Prevention
- Avoid custom repo adapters returning alternate PropertySchema types
- Re-import objects restored from foreign-version backups
- Treat this error as data corruption: inspect and rewrite the object
When it happens
Trigger: patchObject merges an object whose previous properties, when read from the repo, deserialize into something other than map[string]interface{} — typically corrupt or unexpectedly shaped stored properties, or a custom repo/migration returning an alternate PropertySchema implementation.
Common situations: After restoring a backup produced by a different Weaviate version; custom adapters or tests injecting a PropertySchema type like []interface{} or a struct; a schema-migration bug where properties were serialized with a non-map encoder.
Related errors
- malformed numerical aggregator state in shard result
- wrong parameters
- 'ask' invalid parameter
- 'nearText' invalid parameter
- 'nearThermal' invalid parameter
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/be85796dd7c55651.
Report an issue: GitHub.