{"record":{"id":"e2792d15e4203cd3","repo":"weaviate/weaviate","slug":"references-involving-a-multi-tenancy-enabled-class","errorCode":null,"errorMessage":"references involving a multi-tenancy enabled class requires class name in the source beacon url","messagePattern":"references involving a multi-tenancy enabled class requires class name in the source beacon url","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/objects/batch_references_add.go","lineNumber":351,"sourceCode":"\t// no cross-tenant references can be made\n\tif sourceEnabled && targetEnabled {\n\t\tif err := validateTenantRefObject(ctx, repo, sourceClass, source.TargetID, tenant); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"source: %w\", err)\n\t\t}\n\t\tif err := validateTenantRefObject(ctx, repo, targetClass, target.TargetID, tenant); err != nil {\n\t\t\treturn 0, fmt.Errorf(\"target: %w\", err)\n\t\t}\n\t}\n\n\treturn schemaVersion, nil\n}\n\nfunc getReferenceClasses(ctx context.Context,\n\tprincipal *models.Principal, schemaManager schemaManager,\n\tclassFrom, fromProperty, toClassName string, fetchedClasses map[string]versioned.Class,\n) (sourceClass *models.Class, targetClass *models.Class, schemaVersion uint64, err error) {\n\tif classFrom == \"\" {\n\t\terr = fmt.Errorf(\"references involving a multi-tenancy enabled class \" +\n\t\t\t\"requires class name in the source beacon url\")\n\t\treturn sourceClass, targetClass, schemaVersion, err\n\t}\n\n\tfromClass := fetchedClasses[classFrom]\n\tif fromClass.Class == nil {\n\t\terr = fmt.Errorf(\"source class %q not found in schema\", classFrom)\n\t\treturn sourceClass, targetClass, schemaVersion, err\n\t}\n\n\tsourceClass = fromClass.Class\n\tschemaVersion = fromClass.Version\n\n\t// we can auto-detect the to class from the schema if it is a single target reference\n\tif toClassName == \"\" {\n\t\trefProp, err2 := schema.GetPropertyByName(sourceClass, fromProperty)\n\t\tif err2 != nil {\n\t\t\terr = fmt.Errorf(\"get source refprop %q: %w\", classFrom, err2)","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/objects/batch_references_add.go#L333-L369","documentation":"Thrown by getReferenceClasses when the source beacon URL does not contain a class name even though multi-tenancy is involved. For multi-tenancy enabled classes Weaviate must resolve the source class explicitly to run tenant validation, so a class-less beacon form is rejected.","triggerScenarios":"Submitting a batch reference whose 'from' beacon omits the class segment (e.g. \"weaviate://localhost/<uuid>\" instead of \"weaviate://localhost/Article/<uuid>\") for a multi-tenancy enabled class.","commonSituations":"Older clients or scripts written before multi-tenancy that used class-less beacons; hand-built beacon strings; migrations from single-tenant setups.","solutions":["Include the class name in the source beacon: \"weaviate://localhost/<ClassName>/<uuid>\".","Check the from field construction in your client code for string formatting bugs.","If targeting an older Weaviate, upgrade both client and server to MT-consistent versions."],"exampleFix":"// before\n\"from\": \"weaviate://localhost/1a2b3c4d-...\"\n// after\n\"from\": \"weaviate://localhost/Article/1a2b3c4d-...\"","handlingStrategy":"validation","validationCode":"const beacon = `weaviate://localhost/${className}/${uuid}`\nif (!/^weaviate:\\/\\/localhost\\/[^/]+\\/[0-9a-f-]{36}$/i.test(beacon)) throw new Error('beacon must include class name and uuid')","typeGuard":"function hasClassNameInBeacon(beacon) { const parts = beacon.split('/'); return parts.length >= 5 && parts[4].length > 0 }","tryCatchPattern":"try { await addReference(ref) } catch (e) {\n  if (String(e).includes('requires class name in the source beacon url')) { /* rebuild beacon with class */ }\n}","preventionTips":["Build beacons via a helper that always takes (className, uuid)","Never construct class-less beacons for multi-tenant collections","Add a unit test asserting beacon format"],"tags":["multi-tenancy","beacon","batch-references"],"backgroundTag":"invalid-beacon-format","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"}