Skip to main content

Tenant not found (no_such_tenant)

A denied decision with the code no_such_tenant means the tenant in the permission check doesn't exist in the environment. This page is for developers who find this code in a decision log and need to fix the tenant key in the check or create the tenant.

What the no_such_tenant reason means

The policy decision point (PDP) writes this code in the role-based access control (RBAC) part of the decision log's debug details (debug.rbac). The debug details appear when Debug Mode is on.

FieldValue
codeno_such_tenant
reasontenant '<tenant-key>' does not exist. existing tenants: <tenant-keys>
support_linkA link to /errors/no_such_tenant on docs.permit.io

The PDP runs this check after it confirms that the resource type and the action exist. The PDP compares tenant keys exactly, so Acme and acme are different tenants. The reason lists the tenant keys the environment has.

Causes of no_such_tenant

CauseHow to confirmFix
The check sends a misspelled tenant key, or a key with different case.A similar key appears in the existing tenants list of the reason.Send the tenant key from the list in the resource of permit.check(). See Check a permission in a tenant.
The check sends the tenant name instead of the tenant key.The tenant's key differs from its display name in the Directory screen.Send the tenant key in permit.check().
The tenant isn't created in Permit yet.The tenant is missing from the existing tenants list.Create the tenant.
The check runs against a different environment than the one where you created the tenant.The tenant appears in the Directory screen of another environment.Use the API key of the environment that has the tenant. See Get your API key.

Fix no_such_tenant

A new tenant has no users with roles. After you create the tenant, assign roles in it to the users who need access. Otherwise the next check returns no_role_in_tenant or no_user_roles.

Create the tenant in the Permit dashboard

  1. Open the Tenants tab of the Directory screen in the Permit dashboard.
  2. Create a tenant with the key from the check.
  3. In the Users tab, assign roles in the tenant to the users who need access.

Create the tenant with the API

  1. Call the Create tenant endpoint with the tenant key and name. For a complete request, see Create tenant.
  2. If the user doesn't exist yet, call Create user.
  3. Call Assign role with the user, role, and tenant keys.

Create the tenant with an SDK

Confirm the fix

  1. Run the same permit.check() call again with the same user, action, resource, and tenant. To run the check from a terminal, use permit pdp check with --tenant.
  2. Open the Audit Log and select the new decision.

The debug.rbac.code is no longer no_such_tenant.