passbolt/passbolt_api · error · RecordNotFoundException

The SSO setting does not exist.

Error message

The SSO setting does not exist.

What it means

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.

Solutions

  1. Re-fetch the list of SSO settings (GET /sso/settings) and use a current, existing id.
  2. Verify you are pointing at the right environment/database (staging vs production).
  3. Check the sso_settings table for the row (e.g. bin/cake or SQL) to confirm it was deleted.
  4. Handle RecordNotFoundException in the caller and inform the user the settings no longer exist.

Example fix

// before
$dto = $service->getByIdOrFail($id);
// after
try {
    $dto = $service->getByIdOrFail($id);
} catch (RecordNotFoundException $e) {
    $dto = null; // settings were removed; refresh from the list endpoint
}
Defensive patterns

Strategy: try-catch

Validate before calling

$exists = $settingsTable->exists(['id' => $id]); // check before calling

Try / catch

try { $dto = $service->getByIdOrFail($id); } catch (RecordNotFoundException $e) { // treat as 404, offer refresh of settings list }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/e91f77b9e2a8b271. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsGetService.php:53

    /**
     * Return a setting identified with its id
     *
     * @param string $id uuid
     * @throws \Cake\Http\Exception\BadRequestException if $id is not a valid uuid
     * @throws \Cake\Datasource\Exception\RecordNotFoundException if setting cannot be found
     * @throws \Cake\Http\Exception\InternalErrorException if there is an issue with settings data decryption
     * @return \Passbolt\Sso\Model\Dto\SsoSettingsDto
     */
    public function getByIdOrFail(string $id): SsoSettingsDto
    {
        if (!Validation::uuid($id)) {
            throw new BadRequestException(__('The SSO setting id should be a uuid.'));
        }

        try {
            return $this->getOrFail(['id' => $id], true);
        } catch (RecordNotFoundException $exception) {
            throw new RecordNotFoundException(__('The SSO setting does not exist.'), 404, $exception);
        }
    }

    /**
     * Get the currently active setting or return default setting (disabled)
     *
     * @param bool $withData with settings data, e.g. provider specific data
     * @return \Passbolt\Sso\Model\Dto\AbstractSsoSettingsDto
     */
    public function getActiveOrDefault(?bool $withData = false): AbstractSsoSettingsDto
    {
        try {
            return $this->getActiveOrFail($withData);
        } catch (RecordNotFoundException $exception) {
            return new SsoSettingsDefaultDto();
        } catch (Exception $exception) {
            Log::error($exception->getMessage());
            Log::error($exception->getTraceAsString());

View on GitHub (pinned to 31c1bbc10f)