passbolt/passbolt_api · error · RecordNotFoundException
The SSO settings do not exist.
Error message
The SSO settings do not exist.
What it means
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.
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.
Example fix
// before
$dto = $service->getDraftByIdOrFail($id);
// after
try {
$dto = $service->getDraftByIdOrFail($id);
} catch (RecordNotFoundException $e) {
// draft may already be active or deleted; fall back to getActiveOrFail or recreate draft
} Defensive patterns
Strategy: try-catch
Validate before calling
$record = $settingsTable->find()->where(['id' => $id, 'status' => 'draft'])->first(); // pre-check existence and status
Try / catch
try { $dto = $service->getOrFailFilters($id); } catch (RecordNotFoundException $e) { // fall back to getActiveOrFail() or return default disabled settings } Prevention
- 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
When it happens
Trigger: 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.
Common situations: Requesting draft settings after they were promoted to active; requesting active settings before SSO has ever been configured; wrong environment database.
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
- The SSO key does not exist.
- The SSO setting does not exist.
- Record not found in table "sso_auth_tokens"
- The authentication token does not exist.
- The authentication token does not exist or has been deleted.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/275d28ba3a6c0648.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsGetService.php:127
* Get the setting or return default setting (disabled)
*
* @param array $where conditions
* @param bool $withData with settings data, e.g. provider specific data
* @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
*/
protected function getOrFail(array $where, ?bool $withData = false): SsoSettingsDto
{
$ssoSettingsTable = TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoSettings');
try {
/** @var \Passbolt\Sso\Model\Entity\SsoSetting $ssoSettingEntity */
$ssoSettingEntity = $ssoSettingsTable->find()
->where($where)
->orderBy(['modified' => 'DESC'])
->firstOrFail();
} catch (RecordNotFoundException $exception) {
throw new RecordNotFoundException(__('The SSO settings do not exist.'), 400, $exception);
}
if ($withData) {
$jsonData = $this->decrypt($ssoSettingEntity->data);
}
return new SsoSettingsDto($ssoSettingEntity, $jsonData ?? null);
}
/**
* Decrypt the data part of the SsoSetting entity
*
* @param string $data openpgp data
* @throws \Cake\Http\Exception\InternalErrorException if there is an issue with settings data decryption
* @return array
*/
protected function decrypt(string $data): array
{View on GitHub (pinned to 31c1bbc10f)