{"record":{"id":"6ad426d3fe0a622c","repo":"passbolt/passbolt_api","slug":"the-user-does-not-exist","errorCode":null,"errorMessage":"The user does not exist.","messagePattern":"The user does not exist\\.","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"plugins/PassboltEe/AuditLog/src/Controller/UserLogsController.php","lineNumber":54,"sourceCode":"    /**\n     * View action logs for a given user.\n     *\n     * @param string|null $userId user id\n     * @return void\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if the user id has the wrong format\n     * @throws \\Cake\\Http\\Exception\\ForbiddenException if the UAC is not admin\n     * @throws \\Cake\\Http\\Exception\\NotFoundException if the user does not exist\n     */\n    public function view(?string $userId = null)\n    {\n        $this->User->assertIsAdmin(__('Only administrators can view user logs.'));\n\n        // Check request sanity\n        if (!Validation::uuid($userId)) {\n            throw new BadRequestException(__('The user identifier should be a valid UUID.'));\n        }\n        if (!TableRegistry::getTableLocator()->get('Users')->exists(['id' => $userId])) {\n            throw new NotFoundException(__('The user does not exist.'));\n        }\n\n        $this->viewByEntity(new UserActionLogsFinder(), $userId);\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":60,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/AuditLog/src/Controller/UserLogsController.php#L36-L60","documentation":"Thrown by the AuditLog EE plugin's UserLogsController when the userId is a valid UUID but no user with that id exists in the users table. This is a 404 NotFoundException raised after the UUID format check and before rendering the logs.","triggerScenarios":"GET /users/<userId>/logs.json with a syntactically valid UUID that does not match any user row — deleted user, hard-deleted after GDPR purge, or an id from another instance/environment.","commonSituations":"Referencing users removed by the admin or by user deletion during recovery; copying ids from a staging database into production calls; script caches a user list that has since changed.","solutions":["Verify the user id against GET /users.json and use an existing user's id","Check whether the user was deleted (soft-deleted users may still be filtered); restore or pick a valid user","Confirm you are querying the correct passbolt instance/environment","Handle 404 in client code by refreshing the user list rather than retrying the same id"],"exampleFix":"// before\nconst userId = 'aa3bdc52-1af5-4b0e-ae4f-7d0b0bb15f31'; // stale hardcoded id\n// after\nconst user = (await getUsers()).find(u => u.username === email);\nawait get(`/users/${user.id}/logs.json`);","handlingStrategy":"try-catch","validationCode":"const user = (await getUsers()).find(u => u.id === userId);\nif (!user) throw new Error('User does not exist on this instance');","typeGuard":null,"tryCatchPattern":"try {\n  const logs = await getUserLogs(userId);\n} catch (e) {\n  if (e.code === 404 && /does not exist/.test(e.message)) {\n    await refreshUserList(); // user was deleted or id is from another env\n  } else { throw e; }\n}","preventionTips":["Refresh cached user lists before use; users may have been deleted","Never hardcode user UUIDs — fetch them dynamically","Confirm you are calling the correct environment/instance","Handle user-deletion events in integrations to invalidate stored ids"],"tags":["audit-log","user","http-404","not-found"],"backgroundTag":"user-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"}