{"record":{"id":"854daf1643c1fb30","repo":"weaviate/weaviate","slug":"idtoidentifier-q-already-exists-in-a-different-na","errorCode":null,"errorMessage":"IdToIdentifier %q already exists in a different namespace","messagePattern":"IdToIdentifier %q already exists in a different namespace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/auth/authentication/apikey/db_users.go","lineNumber":920,"sourceCode":"\t\t}\n\t\tif newID != id {\n\t\t\tcp.Id = newID\n\t\t\tcp.Namespace = \"\"\n\t\t}\n\t\tout.Users[newID] = cp\n\t}\n\n\tfor id, v := range src.SecureKeyStorageById {\n\t\tnewID := namespacing.StripQualification(id)\n\t\tif _, exists := out.SecureKeyStorageById[newID]; exists {\n\t\t\treturn dbUserdata{}, fmt.Errorf(\"SecureKeyStorageById %q already exists in a different namespace\", id)\n\t\t}\n\t\tout.SecureKeyStorageById[newID] = v\n\t}\n\tfor id, v := range src.IdToIdentifier {\n\t\tnewID := namespacing.StripQualification(id)\n\t\tif _, exists := out.IdToIdentifier[newID]; exists {\n\t\t\treturn dbUserdata{}, fmt.Errorf(\"IdToIdentifier %q already exists in a different namespace\", id)\n\t\t}\n\t\tout.IdToIdentifier[newID] = v\n\t}\n\tfor id := range src.UserKeyRevoked {\n\t\tnewID := namespacing.StripQualification(id)\n\t\tif _, exists := out.UserKeyRevoked[newID]; exists {\n\t\t\treturn dbUserdata{}, fmt.Errorf(\"UserKeyRevoked %q already exists in a different namespace\", id)\n\t\t}\n\t\tout.UserKeyRevoked[newID] = struct{}{}\n\t}\n\t// IdentifierToId is keyed by user id; rewrite the value.\n\tfor identifier, id := range src.IdentifierToId {\n\t\tout.IdentifierToId[identifier] = namespacing.StripQualification(id)\n\t}\n\n\treturn out, nil\n}\n","sourceCodeStart":902,"sourceCodeEnd":938,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/auth/authentication/apikey/db_users.go#L902-L938","documentation":"Namespace stripping found two entries in the IdToIdentifier map from different namespaces that reduce to the same stripped internal ID. The guard blocks the strip because one internal user ID would map to two identifiers (or overwrite), corrupting the identifier lookup after restore.","triggerScenarios":"Thrown at usecases/auth/authentication/apikey/db_users.go:920 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect IdToIdentifier in the snapshot for the colliding internal IDs","Rename or drop one of the colliding dynamic users","Restore without namespace stripping","Fix the source data and re-take the snapshot"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}