weaviate/weaviate · error
parse as time array, expected []interface{} got %T
Error message
parse as time array, expected []interface{} got %T What it means
Thrown during indexing when a date/timestamp array property cannot be processed because the raw stored value is not a []string slice. The code expects date arrays to be stored as strings and coerces each entry via parseAsStringToTime; any other Go type (e.g. []interface{}, []time.Time, or a single value) fails the assertion. The message text misleadingly says 'expected []interface{}' while the assertion actually requires []string.
Source
Thrown at adapters/repos/db/index.go:2160
parsed, err := parseAsStringToTime(raw)
if err != nil {
return errors.Wrapf(err, "time prop %q", prop.Name)
}
propMap[prop.Name] = parsed
}
if prop.DataType[0] == string(schema.DataTypeDateArray) {
raw, ok := propMap[prop.Name]
if !ok {
// prop is not set, nothing to do
continue
}
asSlice, ok := raw.([]string)
if !ok {
return errors.Errorf("parse as time array, expected []interface{} got %T",
raw)
}
parsedSlice := make([]interface{}, len(asSlice))
for j := range asSlice {
parsed, err := parseAsStringToTime(interface{}(asSlice[j]))
if err != nil {
return errors.Wrapf(err, "time array prop %q at pos %d", prop.Name, j)
}
parsedSlice[j] = parsed
}
propMap[prop.Name] = parsedSlice
}
}
return nil
}View on GitHub (pinned to 75aa4b6d11)
Solutions
- Send date array values as an array of RFC3339 strings (e.g. ["2024-01-01T00:00:00Z"]) rather than JSON numbers, objects, or time.Time structs.
- Check the schema: confirm the property datatype is date[] / text[] and that the client serializes the whole array as strings.
- If writing custom indexing code, type-assert to []string (not []interface{}) before calling the time parsing path, or convert []interface{} to []string first.
- Re-import affected objects after fixing the client payload so malformed stored values are replaced.
Example fix
// before
props["dates"] = []interface{}{"2024-01-01T00:00:00Z", "2024-06-01T00:00:00Z"}
// after
props["dates"] = []string{"2024-01-01T00:00:00Z", "2024-06-01T00:00:00Z"} Defensive patterns
Strategy: type-guard
Validate before calling
dates, ok := raw.([]string)
if !ok {
return fmt.Errorf("property %q must be a []string of RFC3339 timestamps, got %T", name, raw)
} Type guard
func isStringSlice(v interface{}) bool { _, ok := v.([]string); return ok } Prevention
- Always send date arrays as arrays of RFC3339 strings in client payloads.
- Validate property value types against the schema before batch import.
- Add client-side serialization tests for date[] properties.
When it happens
Trigger: Batch-inserting or updating an object where a property configured as date[] (text/date array in the schema) arrives with a non-[]string underlying value in the property map — e.g. the value was supplied as a generic JSON array ([]interface{}) or as time.Time values rather than RFC3339 strings.
Common situations: Clients using GraphQL/REST import that send date arrays as native JSON arrays which are deserialized into []interface{} instead of []string; custom import tools writing directly into the shard property map; schema changed a property from single date to date[] (or vice versa) leaving old/mixed typed values.
Related errors
- time array prop %q at pos %d
- parse as time, expected string got %T
- replica movement in progress
- wrong parameters
- 'ask' invalid parameter
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/34b831040cccf2a3.
Report an issue: GitHub.