{"record":{"id":"f4e45e8c598d0a43","repo":"weaviate/weaviate","slug":"unsupported-type-expected-search-localref-or-netw","errorCode":null,"errorMessage":"unsupported type, expected search.LocalRef or NetworkRef, got %T","messagePattern":"unsupported type, expected search\\.LocalRef or NetworkRef, got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/handlers/graphql/local/get/class_builder_references.go","lineNumber":113,"sourceCode":"\t\t\t// unresolved references, this is the case when accepts refs to types\n\t\t\t// ClassA and ClassB and the object only contains refs to one type (e.g.\n\t\t\t// ClassA). Now if the user only asks for resolving all of the other type\n\t\t\t// (i.e. ClassB), then all results would be returned unresolved (as\n\t\t\t// models.MultipleRef).\n\n\t\t\treturn nil, nil\n\t\t}\n\t\tresults := make([]interface{}, len(items))\n\t\tfor i, item := range items {\n\t\t\tswitch v := item.(type) {\n\t\t\tcase search.LocalRef:\n\t\t\t\t// inject some meta data so the ResolveType can determine the type\n\t\t\t\tlocalRef := v.Fields\n\t\t\t\tlocalRef[\"__refClassType\"] = \"local\"\n\t\t\t\tlocalRef[\"__refClassName\"] = v.Class\n\t\t\t\tresults[i] = localRef\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"unsupported type, expected search.LocalRef or NetworkRef, got %T\", v)\n\t\t\t}\n\t\t}\n\t\treturn results, nil\n\t}\n}\n","sourceCodeStart":95,"sourceCodeEnd":119,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/graphql/local/get/class_builder_references.go#L95-L119","documentation":"When resolving a reference field in a GraphQL Get query, makeResolveRefField expects every item in the stored reference list to be a search.LocalRef or NetworkRef. Any other Go type stored under the reference property (e.g. a raw models.MultipleRef or a plain map without the beacon-decoded wrapper) falls into the default branch and returns this formatted error including the actual Go type via %T.","triggerScenarios":"A stored object's reference property contains values that were not decoded into search.LocalRef (e.g. raw beacon maps returned by an extractor that skipped reference resolution), and the client queried that reference field so the GraphQL layer iterates the items.","commonSituations":"Internal invariant violations after upgrades or custom extractors/additional-arguments that return unresolved references; clients writing malformed reference payloads that bypass normal deserialization; code changes to search.Result fields.","solutions":["Check the %T part of the message and trace why that type was stored/returned instead of search.LocalRef","Ensure the object extraction path decodes beacons into search.LocalRef / NetworkRef before GraphQL resolution","Re-import or rewrite the affected objects so their reference properties hold valid beacons","Upgrade Weaviate if this occurs after a version migration (related importer bugs were fixed in later releases)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure imported objects store proper beacons\nfor (const ref of obj[\"hasArticle\"] ?? []) {\n  if (typeof ref.beacon !== \"string\") throw new Error(\"reference must be a beacon object\");\n}","typeGuard":"function isLocalRef(v) {\n  return v != null && typeof v === \"object\" && typeof v.class === \"string\" && typeof v.fields === \"object\";\n}","tryCatchPattern":"try {\n  result = await client.graphql.get().withClassName('Post').withFields('hasArticle { ... on Article { title } }').do();\n} catch (e) {\n  if (String(e).includes('unsupported type')) console.error('Corrupt reference payload — re-import affected objects');\n  throw e;\n}","preventionTips":["Only write references through supported SDK batch APIs that build beacons","After upgrading Weaviate, run a smoke query on ref properties before bulk imports","Never mutate raw search result items before passing them back into GraphQL resolution","Monitor for importer errors indicating unresolved references"],"tags":["graphql","references","type-mismatch"],"backgroundTag":"unsupported-reference-type","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"}