{"record":{"id":"266385a2466c5657","repo":"weaviate/weaviate","slug":"property-q-has-unexpected-data-type-q","errorCode":null,"errorMessage":"property %q has unexpected data type %q","messagePattern":"property %q has unexpected data type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/inverted/nested/assign.go","lineNumber":90,"sourceCode":"\tdt, ok := schema.AsNested(prop.DataType)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"property %q is not a nested type\", prop.Name)\n\t}\n\n\tvar elements []any\n\tswitch dt {\n\tcase schema.DataTypeObject:\n\t\telements = []any{value}\n\tcase schema.DataTypeObjectArray:\n\t\tarr, ok := value.([]any)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected []any for object[] %q, got %T\", prop.Name, value)\n\t\t}\n\t\telements = arr\n\tdefault:\n\t\t// Unreachable: dt is returned by AsNested which only returns members of\n\t\t// NestedDataTypes (DataTypeObject, DataTypeObjectArray).\n\t\treturn nil, fmt.Errorf(\"property %q has unexpected data type %q\", prop.Name, dt)\n\t}\n\n\tif len(elements) == 0 {\n\t\treturn &AssignResult{}, nil\n\t}\n\n\tresult := &AssignResult{}\n\tvar allPositions []uint64\n\n\tfor i, elem := range elements {\n\t\tif i+1 >= MaxRoots {\n\t\t\treturn nil, fmt.Errorf(\"element count %d exceeds maximum %d for property %q\",\n\t\t\t\ti+1, MaxRoots-1, prop.Name)\n\t\t}\n\t\trootIdx := uint16(i + 1)\n\n\t\telemMap, ok := elem.(map[string]any)\n\t\tif !ok {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/inverted/nested/assign.go#L72-L108","documentation":"This is a defensive default branch in AssignPositions' data-type switch. schema.AsNested only returns DataTypeObject or DataTypeObjectArray, so any other value reaching the default branch would indicate a corrupted/inconsistent DataType. The error exists to fail loudly instead of silently skipping the property.","triggerScenarios":"Effectively unreachable in normal operation; would fire only if schema.AsNested's contract changed to return additional nested data types without the switch being updated, or if DataType is corrupted in memory.","commonSituations":"After upgrading Weaviate where schema internals changed; custom forks extending AsNested with new types; debugging unexpected schema state.","solutions":["No user action needed if unmodified — treat any occurrence as a bug and report it with the property definition.","If you maintain a fork, update the switch in assign.go to handle the new AsNested return value.","Verify the property's DataType against the schema to rule out corruption."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"switch {\ncase schema.IsNestedObject(prop.DataType): // ok\ncase schema.IsNestedObjectArray(prop.DataType): // ok\ndefault: // not a nested property; do not call AssignPositions\n}\n","typeGuard":null,"tryCatchPattern":"res, err := nested.AssignPositions(prop, value)\nif err != nil && strings.Contains(err.Error(), \"unexpected data type\") {\n    // report as a bug: AsNested contract violated\n}","preventionTips":["Do not extend schema.AsNested without updating the switch in assign.go.","Pin schema-related upgrades and re-run nested indexing tests after upgrades.","Treat occurrences of this error as invariant violations to report, not to handle."],"tags":["nested-properties","schema","invariant-violation","go"],"backgroundTag":"invariant-violation","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"}