{"record":{"id":"e91f77b9e2a8b271","repo":"passbolt/passbolt_api","slug":"the-sso-setting-does-not-exist-ssosettingsgetservice","errorCode":null,"errorMessage":"The SSO setting does not exist.","messagePattern":"The SSO setting does not exist\\.","errorType":"http","errorClass":"RecordNotFoundException","httpStatus":404,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsGetService.php","lineNumber":53,"sourceCode":"    /**\n     * Return a setting identified with its id\n     *\n     * @param string $id uuid\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if $id is not a valid uuid\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    public function getByIdOrFail(string $id): SsoSettingsDto\n    {\n        if (!Validation::uuid($id)) {\n            throw new BadRequestException(__('The SSO setting id should be a uuid.'));\n        }\n\n        try {\n            return $this->getOrFail(['id' => $id], true);\n        } catch (RecordNotFoundException $exception) {\n            throw new RecordNotFoundException(__('The SSO setting does not exist.'), 404, $exception);\n        }\n    }\n\n    /**\n     * Get the currently active setting or return default setting (disabled)\n     *\n     * @param bool $withData with settings data, e.g. provider specific data\n     * @return \\Passbolt\\Sso\\Model\\Dto\\AbstractSsoSettingsDto\n     */\n    public function getActiveOrDefault(?bool $withData = false): AbstractSsoSettingsDto\n    {\n        try {\n            return $this->getActiveOrFail($withData);\n        } catch (RecordNotFoundException $exception) {\n            return new SsoSettingsDefaultDto();\n        } catch (Exception $exception) {\n            Log::error($exception->getMessage());\n            Log::error($exception->getTraceAsString());","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsGetService.php#L35-L71","documentation":"getByIdOrFail() queries the sso_settings table for the given id; if no record matches, the RecordNotFoundException is caught and rethrown with the user-facing message 'The SSO setting does not exist.' with a 404 status. It means the id was well-formed but no SSO settings row exists with it.","triggerScenarios":"Calling getByIdOrFail() with a UUID that is not present in the sso_settings table, e.g. after the settings were deleted, or using an id from another instance/environment.","commonSituations":"Settings were deleted by another admin between listing and fetching; staging ids used against production; database restored or migrated and old ids no longer exist.","solutions":["Re-fetch the list of SSO settings (GET /sso/settings) and use a current, existing id.","Verify you are pointing at the right environment/database (staging vs production).","Check the sso_settings table for the row (e.g. bin/cake or SQL) to confirm it was deleted.","Handle RecordNotFoundException in the caller and inform the user the settings no longer exist."],"exampleFix":"// before\n$dto = $service->getByIdOrFail($id);\n// after\ntry {\n    $dto = $service->getByIdOrFail($id);\n} catch (RecordNotFoundException $e) {\n    $dto = null; // settings were removed; refresh from the list endpoint\n}","handlingStrategy":"try-catch","validationCode":"$exists = $settingsTable->exists(['id' => $id]); // check before calling","typeGuard":null,"tryCatchPattern":"try { $dto = $service->getByIdOrFail($id); } catch (RecordNotFoundException $e) { // treat as 404, offer refresh of settings list }","preventionTips":["Re-fetch the settings list instead of caching ids long-term","Handle deletion of settings by other admins gracefully","Verify environment/database consistency"],"tags":["sso","not-found","record-not-found"],"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"}