{"record":{"id":"1a31be14a3727ab0","repo":"weaviate/weaviate","slug":"namespaces-are-not-enabled-on-this-cluster-cannot","errorCode":null,"errorMessage":"namespaces are not enabled on this cluster; cannot import into a namespace","messagePattern":"namespaces are not enabled on this cluster; cannot import into a namespace","errorType":"http","errorClass":null,"httpStatus":422,"severity":"error","filePath":"adapters/handlers/rest/db_users/handlers_db_users.go","lineNumber":770,"sourceCode":"\t} else {\n\t\tkeys := make([]string, 0, len(params.Body.Users))\n\t\tfor _, rec := range params.Body.Users {\n\t\t\tkeys = append(keys, apikey.MakeUserKey(bareUserID(rec), targetNamespace))\n\t\t}\n\t\tif err := h.authorizer.Authorize(ctx, principal, authorization.CREATE, authorization.Users(keys...)...); err != nil {\n\t\t\treturn experimental.NewImportUsersForbidden().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, err))\n\t\t}\n\t\tif err := h.authorizer.Authorize(ctx, principal, authorization.UPDATE, authorization.Users(keys...)...); err != nil {\n\t\t\treturn experimental.NewImportUsersForbidden().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, err))\n\t\t}\n\t}\n\n\tif h.namespacesEnabled {\n\t\tif targetNamespace == \"\" {\n\t\t\treturn experimental.NewImportUsersUnprocessableEntity().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, errors.New(\"a target namespace is required on namespace-enabled clusters\")))\n\t\t}\n\t} else if targetNamespace != \"\" {\n\t\treturn experimental.NewImportUsersUnprocessableEntity().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, errors.New(\"namespaces are not enabled on this cluster; cannot import into a namespace\")))\n\t}\n\n\tif len(params.Body.Users) == 0 {\n\t\treturn experimental.NewImportUsersOK().WithPayload(&models.UserImportResponse{Results: []*models.UserImportResult{}})\n\t}\n\n\t// The apply re-checks the namespace; this only saves a round-trip per user\n\t// when this node already knows it is inactive.\n\tif err := namespaces.RequireActive(h.namespaces, targetNamespace); err != nil {\n\t\treturn renderImportUsersNamespaceErr(principal, err)\n\t}\n\n\tresponse := &models.UserImportResponse{Results: make([]*models.UserImportResult, 0, len(params.Body.Users))}\n\tfor _, rec := range params.Body.Users {\n\t\tresponse.Results = append(response.Results, h.importOneUser(ctx, targetNamespace, rec))\n\t}\n\n\treturn experimental.NewImportUsersOK().WithPayload(response)","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/rest/db_users/handlers_db_users.go#L752-L788","documentation":"The inverse of error 65: when namespaces are disabled on the cluster, importUsers rejects any request that still supplies a target namespace, returning 422, because there is no namespace support to import into.","triggerScenarios":"POST /v1/users/db/import with a non-empty namespace field while h.namespacesEnabled is false.","commonSituations":"Replaying an export captured from a namespace-enabled cluster onto a plain cluster; shared import scripts hardcoded with a namespace; copy-pasted request bodies from docs about namespaces.","solutions":["Remove the namespace field from the import body (send {\"users\": [...]})","If the source export contains namespaces, strip them or enable namespaces on the target cluster","Parameterize your import tooling so the namespace field matches the target cluster's namespacesEnabled setting","Check with the cluster admin which mode the target cluster runs in before importing"],"exampleFix":"// before\n{\"namespace\":\"team-a\",\"users\":[{\"username\":\"alice\",\"credentials\":\"...\"}]}\n// after\n{\"users\":[{\"username\":\"alice\",\"credentials\":\"...\"}]}","handlingStrategy":"validation","validationCode":"if !namespacesEnabled && importReq.Namespace != \"\" {\n  return errors.New(\"namespaces are disabled on the target cluster; remove the namespace field\")\n}","typeGuard":"func importBodyValid(b *UserImportRequest, namespacesEnabled bool) bool {\n  return b != nil && (namespacesEnabled || b.Namespace == \"\")\n}","tryCatchPattern":"if resp.StatusCode == 422 && strings.Contains(body, \"namespaces are not enabled\") {\n  return fmt.Errorf(\"strip the namespace field from the import body or enable namespaces\")\n}","preventionTips":["Parameterize import bodies from cluster config instead of hardcoding namespace","Strip namespace fields when moving exports from namespace-enabled to plain clusters","Share one body-builder function keyed on the target cluster's namespacesEnabled flag","Confirm cluster mode with the admin before cross-cluster imports"],"tags":["rest-api","db-users","namespaces","validation"],"backgroundTag":"unsupported-field","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"}