{"record":{"id":"34b831040cccf2a3","repo":"weaviate/weaviate","slug":"parse-as-time-array-expected-interface-got-t","errorCode":null,"errorMessage":"parse as time array, expected []interface{} got %T","messagePattern":"parse as time array, expected \\[\\]interface(.+?) got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/index.go","lineNumber":2160,"sourceCode":"\n\t\t\tparsed, err := parseAsStringToTime(raw)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"time prop %q\", prop.Name)\n\t\t\t}\n\n\t\t\tpropMap[prop.Name] = parsed\n\t\t}\n\n\t\tif prop.DataType[0] == string(schema.DataTypeDateArray) {\n\t\t\traw, ok := propMap[prop.Name]\n\t\t\tif !ok {\n\t\t\t\t// prop is not set, nothing to do\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tasSlice, ok := raw.([]string)\n\t\t\tif !ok {\n\t\t\t\treturn errors.Errorf(\"parse as time array, expected []interface{} got %T\",\n\t\t\t\t\traw)\n\t\t\t}\n\t\t\tparsedSlice := make([]interface{}, len(asSlice))\n\t\t\tfor j := range asSlice {\n\t\t\t\tparsed, err := parseAsStringToTime(interface{}(asSlice[j]))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrapf(err, \"time array prop %q at pos %d\", prop.Name, j)\n\t\t\t\t}\n\n\t\t\t\tparsedSlice[j] = parsed\n\t\t\t}\n\t\t\tpropMap[prop.Name] = parsedSlice\n\n\t\t}\n\t}\n\n\treturn nil\n}","sourceCodeStart":2142,"sourceCodeEnd":2178,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/index.go#L2142-L2178","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nprops[\"dates\"] = []interface{}{\"2024-01-01T00:00:00Z\", \"2024-06-01T00:00:00Z\"}\n// after\nprops[\"dates\"] = []string{\"2024-01-01T00:00:00Z\", \"2024-06-01T00:00:00Z\"}","handlingStrategy":"type-guard","validationCode":"dates, ok := raw.([]string)\nif !ok {\n    return fmt.Errorf(\"property %q must be a []string of RFC3339 timestamps, got %T\", name, raw)\n}","typeGuard":"func isStringSlice(v interface{}) bool { _, ok := v.([]string); return ok }","tryCatchPattern":null,"preventionTips":["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."],"tags":["go","type-assertion","date-parsing","indexing"],"backgroundTag":"type-assertion-failed","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"}