passbolt/passbolt_api · error · InternalErrorException
Could not save the SSO state, please try again later.
Error message
Could not save the SSO state, please try again later.
What it means
create() wraps $ssoStatesTable->saveOrFail() in a try/catch: any CakeException during the database insert is converted to InternalErrorException so the caller never sees raw DB errors. The nonce was valid, but persistence failed.
Solutions
- Run migrations: `ddev refresh` or `bin/cake migrations migrate` so the sso_states table exists
- Check DB connectivity and credentials in config/app.php
- Inspect the chained exception ($e) in the error log for the real cause
- Verify the nonce is unique — regenerate the state if a retry reuses the same nonce
Defensive patterns
Strategy: try-catch
Validate before calling
$tables = \Cake\ORM\TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoStates'); if (!$tables->getConnection()->query('SELECT 1')->execute()) { /* check DB before SSO flows */ } Try / catch
try { $state = $service->create($uac, $nonce); } catch (InternalErrorException $e) { Log::error('SSO state save failed: ' . $e->getPrevious()?->getMessage()); return $this->respondError(500, $e->getMessage()); } Prevention
- Run migrations after installing/upgrading the SSO plugin
- Monitor DB health and connection limits
- Include the previous exception in server logs for diagnosis
When it happens
Trigger: saveOrFail() throws — DB connection failure, unique nonce constraint violation, schema mismatch (missing sso_states table after failed migration), or datasource misconfiguration.
Common situations: Migrations not run after installing/upgrading the SSO plugin; database down or read-only; duplicate nonce collision on retry; permissions issue on the DB user.
Related errors
- Could not delete the draft SSO settings.
- Could not delete the SSO settings.
- Could not save the user data. Please try again later.
- Could not update the SSO settings.
- It is not possible to save the SSO settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/93c72bf78558e84d.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/Sso/src/Service/SsoStates/SsoStatesSetService.php:82
'deleted' => DateTime::now()->modify('+' . SsoState::getExpiryDuration()),
],
[
'accessibleFields' => [
'nonce' => true,
'state' => true,
'type' => true,
'sso_settings_id' => true,
'user_id' => true,
'ip' => true,
'user_agent' => true,
'deleted' => true,
],
],
);
$ssoState = $ssoStatesTable->saveOrFail($ssoState);
} catch (CakeException $e) {
throw new InternalErrorException(
__('Could not save the SSO state, please try again later.'),
500,
$e
);
}
return $ssoState;
}
}
View on GitHub (pinned to 31c1bbc10f)