The short answer: 404 NotAuthorizedOrNotFound does not tell you which of two things happened. Oracle's API error reference defines it as "A resource specified via the URI (path or query parameters) of the request was not found, or you do not have authorization to access that resource". The same code for an OCID that does not exist and for a resource that exists but your group cannot see. In practice that is three causes: the OCID, the compartment or the region is wrong; there is no policy covering your group in that compartment (or it is attached to the wrong compartment); or the CLI profile points at another tenancy or another region. Three read-only commands separate them, and it pays to start with the last one: the profile check.
What follows is what I do when this error lands in a terraform apply or in an oci ... get that worked yesterday. I read the Oracle pages cited at the end today; whatever is not in them, I label as what it is: my reading.
What the error looks like
In the CLI it is a JSON with "code": "NotAuthorizedOrNotFound", "status": 404 and the message Authorization failed or requested resource not found. In Terraform, the troubleshooting guide for the OCI provider shows it in this shape:
Error: 404-NotAuthorizedOrNotFound Provider version: <provider_version>, released on <release_date>. This provider is <n> updates behind to current. Service: <service> Error Message: Authorization failed or requested resource not found. OPC request ID: exampleuniqueID Suggestion: Either the resource has been deleted or service <service> need policy to access this resource. Policy reference: <link> The provider's suggestion already anticipates both readings: the resource was deleted, or a policy is missing. The same API error page adds two neighbours worth recognising: 400 RelatedResourceNotAuthorizedOrNotFound when the missing resource comes in the request body (the subnet of a launch, for instance) rather than the URI, and 409 NotAuthorizedOrResourceAlreadyExists on create operations, where it replaces the general 404. If the error you have is one of those two, the cause is the same family, but the resource to check is a different one.
Cause 1: the OCID, the compartment or the region
The dumbest and the most frequent. An OCID pasted one character short, the OCID of a compartment someone deleted, or a regional resource (instance, VCN, bucket) requested from another region. The last one is misleading because the CLI answers with the same 404 as if you had no permission: the instance exists, but in sa-saopaulo-1, and your profile is in us-ashburn-1. The first command rules it out:
oci iam compartment get --compartment-id ocid1.compartment.oc1..aaaaaaaaxxxx # expected: a JSON with "name", "lifecycle-state": "ACTIVE" and "compartment-id" (the parent) # if "lifecycle-state" is "DELETED", the OCID belonged to a deleted compartment # if it returns 404, the OCID is wrong or your group cannot even inspect that compartment Compartments are IAM resources: they live in the home region and are available in every region, so this get does not depend on the profile's region. That is why it works as the first filter: if the compartment resolves and the resource inside it still returns 404, the problem is in the resource (wrong region) or in the policy, not in the compartment. The command reference notes that it does not list what is inside; for that you call the list operation of each resource type with the compartment as a parameter.
Cause 2: no policy covers your group in that compartment
On OCI there is no access without an Allow. The basic syntax, per Oracle's policies page, is Allow group <group_name> to <verb> <resource-type> in compartment <compartment_name>, and statements only allow: there is no Deny, whatever is not written is denied. A group with no statement naming it in that compartment gets a 404, not a 403. The second command lists the statements you need to read:
# in the tenancy (root compartment) and in every compartment on the path down to the resource oci iam policy list --compartment-id ocid1.tenancy.oc1..aaaaaaaayyyy --all \ --query 'data[].{name:name, statements:statements}' --output json oci iam policy list --compartment-id ocid1.compartment.oc1..aaaaaaaaxxxx --all \ --query 'data[].statements[]' --output json # expected: at least one statement naming your group and that compartment (or an ancestor) You have to run it more than once because of a design detail: the same reference says that to determine which policies apply to a group or a compartment you must view the individual statements inside all your policies, because there is no API call that answers it directly. And inheritance goes downwards: Oracle writes that compartments inherit any policies from their parent compartment, with the example Allow group NetworkAdmins to manage virtual-network-family in compartment CompartmentA, which reaches CompartmentA, CompartmentB and CompartmentC when B is inside A and C inside B.
The most common trap I see is the sibling one. The policy says Allow group DevOps to manage instance-family in compartment Project-A and is attached to Project-A. The instance launches in Project-A, but the subnet lives in Networks, which is a sibling of Project-A, not a child. Inheritance does not cross sideways: DevOps can manage instances in Project-A and cannot even see the subnet in Networks, and the launch returns the 404 (or the related-resource 400) on the subnet. Oracle shows the right shape in its own example, with a third statement for the network: Allow group A-Admins to use virtual-network-family in compartment Networks. One attachment detail: the page says that when the policy is attached higher in the hierarchy than the compartment it names, the statement has to carry the path with colons, CompartmentA:CompartmentB:CompartmentC.
Cause 3: the wrong profile, tenancy or region
The third cause shows up when more than one ~/.oci/config is in play: two tenancies, a DEFAULT profile still pointing at the personal account, an OCI_CLI_PROFILE exported in another terminal, or a region in the profile that is not where the resource is. All of that yields the same 404, because from the wrong tenancy the OCID simply does not exist. The two commands of the third step tell you who you are talking to:
oci os ns get # expected: {"data": "<namespace>"}; the namespace is unique per tenancy, if it is not the one you expected, the profile points at another account oci iam region-subscription list --query 'data[].{region:"region-name", home:"is-home-region"}' --output table # expected: the list of subscribed regions, exactly one with home = true; # if your profile's region (or --region) is not in the list, the resource cannot be there The os ns get reference says each tenancy is assigned one unique, uneditable namespace and that the command returns the one for the user making the request: it is the cheapest "am I in the right tenancy" check there is. The region-subscription one lists the subscribed regions of that tenancy. And this is where the home region comes in: Oracle's regions page says users, groups, policies and compartments are created and updated only in the home region, that the policies from the home region are enforced in the other regions, and that a change might take several minutes to become available in all of them. If you created the policy a moment ago and the 404 persists, it may be that, and not another mistake.
Order matters
Profile first (step 3), because if you are in the wrong tenancy the other two commands lie as well. Then the compartment (step 1), because it does not depend on the region. Policies last (step 2), the only step where you have to read rather than compare. In a terraform apply, the OPC request ID in the error is the thing to keep: it is what Oracle support asks for to find the request on their side.
FAQ
Why does OCI not distinguish between "not found" and "not authorized"? The error page does not explain the reason; what it documents is the behaviour, the same code for both cases and the same recommendation: check that the resource exists and that you have access to it. The practical effect is that a caller without permission cannot learn whether an OCID exists, and that is what I tell the team when they ask.
Does a deleted resource also return 404? Yes. The Terraform provider's suggestion puts it first: "Either the resource has been deleted or service need policy to access this resource". A data source pointing at an OCID someone deleted from the console returns exactly this error at plan time.
Is it enough to put the group in the tenancy? A statement in tenancy covers every compartment through inheritance, and that is what the Administrators policy that ships with the account does. It is useful to confirm the problem was the policy; it is not the policy you want to keep.
Where Control Cloud fits, and where it does not
Control Cloud reads the tenancy through the OCI API with a read-only credential, and the pre-flight before a deploy uses that same credential: it verifies that the API answers, that the extended inventory has loaded and that no region returned an error when read; if one did, it flags a warning with the region name and suggests reviewing the credential's permissions on that scope. Then it looks at the network (subnet, internet egress), the template's dependencies and the hosts. It also has an error dictionary that recognises NotAuthorizedOrNotFound and returns the why, the fix and the command oci iam policy list --compartment-id <comp> --all to verify it. What it does not do today: it does not evaluate which policy covers which group in which compartment, it does not check quotas, and it does not run as a CI hook or expose a public API. If you want to see your tenancy on a map, you can request access; the Team plan has a 7-day trial with no card.
The last time this 404 landed on you: was it a badly pasted OCID, a policy attached to the wrong compartment, or a profile looking at another region? And if it was the policy, which compartment was it in, and which one did the resource live in?
Sources
- Oracle, "API Errors" (https://docs.oracle.com/en-us/iaas/Content/API/References/apierrors.htm): definition of
404 NotAuthorizedOrNotFound,400 RelatedResourceNotAuthorizedOrNotFound,409 NotAuthorizedOrResourceAlreadyExistsand the troubleshooting recommendation. Read 2026-11-25. - Oracle, "How Policies Work" (https://docs.oracle.com/en-us/iaas/Content/Identity/Concepts/policies.htm):
Allow group ... in compartment ...syntax, Allow only, inheritance into child compartments, attachment to a single compartment, colon path, the Project-A and Networks example. Read 2026-11-25. - Oracle, "Managing Regions" (https://docs.oracle.com/en-us/iaas/Content/Identity/regions/managingregions.htm): the home region, which IAM resources change only there, home-region policies enforced in the other regions, propagation of several minutes. Read 2026-11-25.
- Oracle, "Troubleshooting" for the OCI Terraform provider (https://docs.oracle.com/en-us/iaas/Content/dev/terraform/troubleshooting.htm): shape of the
404-NotAuthorizedOrNotFounderror and its suggestion. Read 2026-11-25. - OCI CLI reference:
oci iam compartment get(https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/iam/compartment/get.html),oci iam policy list(https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/iam/policy/list.html),oci os ns get(https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/os/ns/get.html) andoci iam region-subscription list(https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/iam/region-subscription/list.html). Read 2026-11-25.