{"record":{"id":"1afc6f9ae2a39ec7","repo":"passbolt/passbolt_api","slug":"the-sso-key-does-not-exist","errorCode":null,"errorMessage":"The SSO key does not exist.","messagePattern":"The SSO key does not exist\\.","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoKeys/SsoKeysDeleteService.php","lineNumber":46,"sourceCode":"{\n    /**\n     * Delete a Sso key\n     *\n     * @param \\App\\Utility\\UserAccessControl $uac user access control\n     * @param string $id uuid\n     * @return void\n     */\n    public function delete(UserAccessControl $uac, string $id): void\n    {\n        if (!Validation::uuid($id)) {\n            throw new BadRequestException(__('The SSO key id should be a uuid.'));\n        }\n\n        $SsoKeys = TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoKeys');\n        try {\n            $entity = $SsoKeys->find()->where(['id' => $id, 'user_id' => $uac->getId()])->firstOrFail();\n        } catch (RecordNotFoundException $exception) {\n            throw new NotFoundException(__('The SSO key does not exist.'));\n        }\n\n        if (!$SsoKeys->delete($entity)) {\n            throw new InternalErrorException(__('The SSO key could not be deleted.'));\n        }\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":54,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoKeys/SsoKeysDeleteService.php#L28-L54","documentation":"After validating the UUID, delete() looks up the SSO key scoped to both its id and the current user id (user_id = uac->getId()) and throws NotFoundException('The SSO key does not exist.') when firstOrFail() raises RecordNotFoundException. The scoping means a key belonging to another user is indistinguishable from a nonexistent key.","triggerScenarios":"Deleting an already-deleted SSO key, using a key id that exists but belongs to a different user, or referencing a key on the wrong instance/database.","commonSituations":"Double DELETE from a retrying client; stale UI cache listing a removed key; multi-user testing where the key was created by another account; pointing the client at a different passbolt environment.","solutions":["Confirm the key id exists and belongs to the authenticated user (query the sso_keys table with id + user_id)","Refresh the key list in the client before retrying so stale ids are dropped","Make delete idempotent client-side: treat 404 for already-deleted keys as success","Verify you are connected to the intended passbolt instance (staging vs prod)"],"exampleFix":"// before: delete blindly on retry\nawait deleteKey(id); // 404 on second attempt\n// after\ntry { await deleteKey(id); } catch (e) { if (e.status === 404) return; throw e; }","handlingStrategy":"try-catch","validationCode":"// pre-check existence and ownership\n$key = $SsoKeys->find()->where(['id' => $id, 'user_id' => $uac->getId()])->first();\nif (!$key) {\n    // skip delete or refresh key list\n}","typeGuard":null,"tryCatchPattern":"try {\n    $service->delete($uac, $id);\n} catch (NotFoundException $e) {\n    // treat as already-deleted; make retries idempotent\n    return;\n}","preventionTips":["Refresh the key list before retrying deletes","Treat 404 on delete as success for idempotent retries","Confirm you operate on the intended passbolt instance/database"],"tags":["sso","not-found","resource-missing","delete"],"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"}