weaviate/weaviate · error

namespaces are not enabled on this cluster; cannot import in

Error message

namespaces are not enabled on this cluster; cannot import into a namespace

What it means

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.

Source

Thrown at adapters/handlers/rest/db_users/handlers_db_users.go:770

	} else {
		keys := make([]string, 0, len(params.Body.Users))
		for _, rec := range params.Body.Users {
			keys = append(keys, apikey.MakeUserKey(bareUserID(rec), targetNamespace))
		}
		if err := h.authorizer.Authorize(ctx, principal, authorization.CREATE, authorization.Users(keys...)...); err != nil {
			return experimental.NewImportUsersForbidden().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, err))
		}
		if err := h.authorizer.Authorize(ctx, principal, authorization.UPDATE, authorization.Users(keys...)...); err != nil {
			return experimental.NewImportUsersForbidden().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, err))
		}
	}

	if h.namespacesEnabled {
		if targetNamespace == "" {
			return experimental.NewImportUsersUnprocessableEntity().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, errors.New("a target namespace is required on namespace-enabled clusters")))
		}
	} else if targetNamespace != "" {
		return experimental.NewImportUsersUnprocessableEntity().WithPayload(cerrors.ErrPayloadFromSingleErr(principal, errors.New("namespaces are not enabled on this cluster; cannot import into a namespace")))
	}

	if len(params.Body.Users) == 0 {
		return experimental.NewImportUsersOK().WithPayload(&models.UserImportResponse{Results: []*models.UserImportResult{}})
	}

	// The apply re-checks the namespace; this only saves a round-trip per user
	// when this node already knows it is inactive.
	if err := namespaces.RequireActive(h.namespaces, targetNamespace); err != nil {
		return renderImportUsersNamespaceErr(principal, err)
	}

	response := &models.UserImportResponse{Results: make([]*models.UserImportResult, 0, len(params.Body.Users))}
	for _, rec := range params.Body.Users {
		response.Results = append(response.Results, h.importOneUser(ctx, targetNamespace, rec))
	}

	return experimental.NewImportUsersOK().WithPayload(response)

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Remove the namespace field from the import body (send {"users": [...]})
  2. If the source export contains namespaces, strip them or enable namespaces on the target cluster
  3. Parameterize your import tooling so the namespace field matches the target cluster's namespacesEnabled setting
  4. Check with the cluster admin which mode the target cluster runs in before importing

Example fix

// before
{"namespace":"team-a","users":[{"username":"alice","credentials":"..."}]}
// after
{"users":[{"username":"alice","credentials":"..."}]}
Defensive patterns

Strategy: validation

Validate before calling

if !namespacesEnabled && importReq.Namespace != "" {
  return errors.New("namespaces are disabled on the target cluster; remove the namespace field")
}

Type guard

func importBodyValid(b *UserImportRequest, namespacesEnabled bool) bool {
  return b != nil && (namespacesEnabled || b.Namespace == "")
}

Try / catch

if resp.StatusCode == 422 && strings.Contains(body, "namespaces are not enabled") {
  return fmt.Errorf("strip the namespace field from the import body or enable namespaces")
}

Prevention

When it happens

Trigger: POST /v1/users/db/import with a non-empty namespace field while h.namespacesEnabled is false.

Common situations: 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.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/1a31be14a3727ab0. Report an issue: GitHub.