{"record":{"id":"d321708ad100f12f","repo":"passbolt/passbolt_api","slug":"the-resource-does-not-exist-d32170","errorCode":null,"errorMessage":"The resource does not exist.","messagePattern":"The resource does not exist\\.","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"plugins/PassboltCe/SecretRevisions/src/Controller/SecretRevisionsResourceGetController.php","lineNumber":71,"sourceCode":"    {\n        $this->assertJson();\n\n        // Check request sanity\n        if (!Validation::uuid($resourceId)) {\n            throw new BadRequestException(__('The resource identifier should be a valid UUID.'));\n        }\n\n        // Retrieve and sanity the query options.\n        $whitelist = ['contain' => [\n            'creator', 'creator.profile', 'secret',\n        ]];\n        $options = $this->QueryString->get($whitelist);\n\n        // Retrieve the resource.\n        /** @var \\App\\Model\\Entity\\Resource $resource */\n        $resource = $this->Resources->findView($this->User->id(), $resourceId)->first();\n        if (empty($resource)) {\n            throw new NotFoundException(__('The resource does not exist.'));\n        }\n\n        // Filter by secrets by userId and the revision by secret revision\n        $secretRevisionsBaseQuery = $this->Resources->SecretRevisions\n            ->find()\n            ->innerJoinWith('Secrets', function (Query $q) {\n                return $q->where(['Secrets.user_id' => $this->User->id()]);\n            })\n            ->where(['SecretRevisions.resource_id' => $resourceId]);\n\n        if ($options['contain']['secret'] ?? false) {\n            $secretRevisionsBaseQuery->contain('Secrets', function (Query $q) {\n                return $q->where(['Secrets.user_id' => $this->User->id()]);\n            });\n        }\n        if ($options['contain']['creator'] ?? false) {\n            $secretRevisionsBaseQuery->contain('Creator');\n        }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/SecretRevisions/src/Controller/SecretRevisionsResourceGetController.php#L53-L89","documentation":"Thrown by SecretRevisionsResourceGetController::get() when Resources->findView($userId, $resourceId) returns no row, meaning the resource either does not exist or the authenticated user lacks access to it (findView applies ACL). NotFoundException maps to HTTP 404.","triggerScenarios":"GET secret revisions for a resource ID that is absent, already deleted, or invisible to the requesting user because permission is missing.","commonSituations":"Resource hard-deleted or soft-deleted before the call; user not shared on the resource (permission not granted); querying the wrong environment's database; stale ID cached in a UI after deletion.","solutions":["Confirm the resource exists and is visible to the user via GET /resources/:id before fetching revisions","Grant the requesting user access (share the resource) if the intent is to allow revision reads","Verify you are hitting the intended environment/database","Handle 404 in the client by refreshing the resource list"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const resource = await api.getResource(resourceId); // will 404 early if absent/inaccessible\nif (!resource) return null;","typeGuard":null,"tryCatchPattern":"try {\n  const revisions = await api.getSecretRevisionsForResource(resourceId);\n} catch (e) {\n  if (e.status === 404) { /* resource deleted or no permission — refresh list */ }\n  throw e;\n}","preventionTips":["Verify user access to the resource before fetching revisions","Refresh UI state after deletions to avoid stale IDs","Handle 404 as 'absent or no access' without distinguishing to end users"],"tags":["not-found","acl","permissions"],"backgroundTag":"entity-not-found","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}