Resource type not defined (no_such_resource)
A denied decision with the code no_such_resource means the resource type in the permission check doesn't exist in the environment's policy. This page is for developers who find this code in a decision log and need to fix the resource type in the check or create the resource.
What the no_such_resource 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.
| Field | Value |
|---|---|
code | no_such_resource |
reason | resource type '<resource-type>' is not defined. known resource types: <resource-type-keys> |
support_link | A link to /errors/no_such_resource on docs.permit.io |
The resource type check is the first RBAC check the PDP runs. The PDP compares resource type keys exactly, so Document and document are different resource types. The reason lists the resource type keys the environment has.
Causes of no_such_resource
| Cause | How to confirm | Fix |
|---|---|---|
| The check sends a misspelled resource type key, or a key with different case. | A similar key appears in the known resource types list of the reason. | Send the resource type key from the list in permit.check(). |
| The check sends the resource name instead of the resource key. | The resource's key differs from its display name on the Policy screen. | Send the resource key in permit.check(). |
| The resource type isn't created yet. | The resource type is missing from the known resource types list. | Create the resource. |
| The check runs against a different environment than the one where you created the resource. | The resource appears on the Policy screen of another environment. | Use the API key of the environment that has the resource. See Get your API key. |
Fix no_such_resource
Create the resource in the Permit dashboard
- Open the Policy screen in the Permit dashboard and select the Resources tab.
- Add a resource with the key from the check, and add its actions.
- In the Policy Editor, grant the actions to the roles that need them.
For a walkthrough with screenshots, see Create the document resource.
Create the resource with the API
Call the Create resource endpoint with the resource key, name, and actions.
Create the resource with an SDK
Confirm the fix
- Run the same
permit.check()call again with the same user, action, resource, and tenant. To run the check from a terminal, usepermit pdp check. - Open the Audit Log and select the new decision.
The debug.rbac.code is no longer no_such_resource. If the code is no_such_action, the resource type exists, and the action isn't defined on it. See Action not defined on the resource (no_such_action).