{"record":{"id":"275d28ba3a6c0648","repo":"passbolt/passbolt_api","slug":"the-sso-settings-do-not-exist","errorCode":null,"errorMessage":"The SSO settings do not exist.","messagePattern":"The SSO settings do not exist\\.","errorType":"http","errorClass":"RecordNotFoundException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsGetService.php","lineNumber":127,"sourceCode":"     * Get the setting or return default setting (disabled)\n     *\n     * @param array $where conditions\n     * @param bool $withData with settings data, e.g. provider specific data\n     * @throws \\Cake\\Datasource\\Exception\\RecordNotFoundException if setting cannot be found\n     * @throws \\Cake\\Http\\Exception\\InternalErrorException if there is an issue with settings data decryption\n     * @return \\Passbolt\\Sso\\Model\\Dto\\SsoSettingsDto\n     */\n    protected function getOrFail(array $where, ?bool $withData = false): SsoSettingsDto\n    {\n        $ssoSettingsTable = TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoSettings');\n        try {\n            /** @var \\Passbolt\\Sso\\Model\\Entity\\SsoSetting $ssoSettingEntity */\n            $ssoSettingEntity = $ssoSettingsTable->find()\n                ->where($where)\n                ->orderBy(['modified' => 'DESC'])\n                ->firstOrFail();\n        } catch (RecordNotFoundException $exception) {\n            throw new RecordNotFoundException(__('The SSO settings do not exist.'), 400, $exception);\n        }\n\n        if ($withData) {\n            $jsonData = $this->decrypt($ssoSettingEntity->data);\n        }\n\n        return new SsoSettingsDto($ssoSettingEntity, $jsonData ?? null);\n    }\n\n    /**\n     * Decrypt the data part of the SsoSetting entity\n     *\n     * @param string $data openpgp data\n     * @throws \\Cake\\Http\\Exception\\InternalErrorException if there is an issue with settings data decryption\n     * @return array\n     */\n    protected function decrypt(string $data): array\n    {","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsGetService.php#L109-L145","documentation":"getOrFail() performs a find with a where clause (id, optionally status) and firstOrFail(); when nothing matches it rethrows RecordNotFoundException with 'The SSO settings do not exist.' at HTTP 400. It is the shared lookup used by getByIdOrFail, getActiveOrFail and getDraftByIdOrFail, so it fires whenever no row satisfies the combined conditions.","triggerScenarios":"Fetching an id that doesn't exist; calling getDraftByIdOrFail() with the id of a settings record whose status is not 'draft' (e.g. already activated); calling getActiveOrFail() when no active settings exist.","commonSituations":"Requesting draft settings after they were promoted to active; requesting active settings before SSO has ever been configured; wrong environment database.","solutions":["Verify the settings record exists and check its status column (draft vs active) matches what the caller requires.","For drafts: re-create the draft if it was activated or deleted; for active: configure SSO settings first.","Handle RecordNotFoundException and return the default disabled-settings DTO as appropriate (getActiveOrFail already supports this pattern).","Confirm you are querying the correct database/environment."],"exampleFix":"// before\n$dto = $service->getDraftByIdOrFail($id);\n// after\ntry {\n    $dto = $service->getDraftByIdOrFail($id);\n} catch (RecordNotFoundException $e) {\n    // draft may already be active or deleted; fall back to getActiveOrFail or recreate draft\n}","handlingStrategy":"try-catch","validationCode":"$record = $settingsTable->find()->where(['id' => $id, 'status' => 'draft'])->first(); // pre-check existence and status","typeGuard":null,"tryCatchPattern":"try { $dto = $service->getOrFailFilters($id); } catch (RecordNotFoundException $e) { // fall back to getActiveOrFail() or return default disabled settings }","preventionTips":["Check the record's status before requesting draft vs active","Create a draft before attempting to read one","Handle not-found by returning default disabled settings where the UI allows"],"tags":["sso","not-found","record-not-found","draft"],"backgroundTag":"record-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"}