passbolt/passbolt_api · error · NotFoundException
The resource does not exist.
Error message
The resource does not exist.
What it means
After UUID validation, addPost() loads the resource with Resources->findView($uac->getId(), $resourceId, options) filtered by the caller's permissions; if the query returns nothing it throws NotFoundException 'The resource does not exist.' The error covers both hard-nonexistence and soft cases where the resource exists but the user lacks permission (deleted, not shared).
Solutions
- Refresh the resource list (GET /resources.json) and confirm the id exists for this user
- Log in as a user with access, or share the resource with the caller first
- Check the resources table for the id and its deleted flag if debugging server-side
Example fix
// before
await addTags(resourceId, tags); // 404 if resource gone
// after
const resource = await api.get(`/resources/${resourceId}.json`).catch(() => null);
if (!resource) throw new Error('Resource unavailable for this user');
await addTags(resourceId, tags); Defensive patterns
Strategy: try-catch
Validate before calling
const res = await api.get(`/resources/${resourceId}.json`).catch(() => null);
if (!res) throw new Error('Resource not accessible for this user'); Type guard
null
Try / catch
try { await addResourceTags(id, tags); } catch (e) { if (e.status === 404) { /* refresh resource list / check permissions */ } else throw e; } Prevention
- Refresh cached resource ids before mutations
- Share resources with users who need tag access
- Treat 404 as 'deleted or no permission' in clients
When it happens
Trigger: Adding tags to a resourceId that was deleted, that is not shared with the calling user, or that belongs to another user's private space.
Common situations: Stale resource id cached in a client after the resource was deleted; attempting tag updates on a resource visible to a teammate but not to you; soft-deleted resources still present in client state.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Could not validate resource data.
- Entity not found.
- Only administrators can update the subscription details.
- Only administrators can view the subscription details.
- The folder does not exist.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/d4004569875e6444.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/Tags/src/Controller/Tags/ResourcesTagsAddController.php:75
* @throws \Cake\Http\Exception\BadRequestException
* @throws \Cake\Http\Exception\NotFoundException
* @return void
*/
public function addPost(string $resourceId)
{
if (!Validation::uuid($resourceId)) {
throw new BadRequestException(__('The resource identifier should be a valid UUID.'));
}
$uac = $this->User->getAccessControl();
$data = $this->formatRequestData();
$data = $this->validateRequestData($data, $uac);
$options = ['contain' => ['all_tags' => 1, 'permission' => 1]];
/** @var \App\Model\Entity\Resource|null $resource */
$resource = $this->Resources->findView($uac->getId(), $resourceId, $options)->first();
if (is_null($resource)) {
throw new NotFoundException(__('The resource does not exist.'));
}
$tags = (new ResourcesTagsAddService())->add($uac, $resource, $data);
$tags = (new MetadataTagsRenderService())->renderTags($tags);
$this->success(__('The operation was successful.'), $tags);
}
/**
* Get and format the request data.
*
* @return array
*/
private function formatRequestData(): array
{
$data = $this->getRequest()->getData();
// Data given in V1 format.
// @deprecated with v2View on GitHub (pinned to 31c1bbc10f)