passbolt/passbolt_api · critical · InternalErrorException
Could not save the role, please try again later.
Error message
Could not save the role, please try again later.
What it means
RolesAddService::add wraps any non-persistence Exception from the roles save in an InternalErrorException with this message. It signals an unexpected server-side failure (DB outage, driver error) rather than a validation problem; the original exception is chained for logs.
Solutions
- Retry the request after a short delay; the message itself suggests a transient condition.
- Check the application error log for the chained exception to see the root cause.
- Verify database health: connectivity, disk space, and replication status.
- If persistent, run `ddev refresh` (or your migrations) to confirm schema integrity for the roles table.
- Contact/passbolt ops if the DB error persists — this is not fixable from the client.
Example fix
// before curl -X POST /roles ... -> 500 Could not save the role (DB down) // after # restart/repair DB, then retry curl -X POST /roles ... -> 201
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
try {
await api.createRole(role);
} catch (e) {
if (e.status === 500 && /could not save the role/i.test(e.message)) {
await delay(backoff++ * 1000); // retry transient DB failure a few times
} else throw e;
} Prevention
- Monitor database health (connectivity, disk, replication) when role admin operations spike
- Log the chained exception server-side to identify root causes quickly
- Avoid bulk role creation during DB maintenance windows
- Set idempotent retry with backoff on 500s
When it happens
Trigger: POST /roles when $rolesTable->saveOrFail throws a generic Exception — e.g. database connection lost, SQL error, table locked, or transaction failure during the INSERT.
Common situations: MySQL/MariaDB/Postgres temporarily down or restart under load, disk full on the DB server, deadlocks during bulk role creation, or network interruption between app server and database.
Related errors
- Could not delete the role, please try again later.
- Could not update the role, please try again later.
- Could not delete the draft SSO settings.
- Could not delete the SSO settings.
- Could not update the SSO settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/1d55f036eb0b7350.
Report an issue: GitHub.
Appendix: source
Thrown at src/Service/Roles/RolesAddService.php:69
$role = $rolesTable->newEntity($data, ['accessibleFields' => [
'name' => true,
'description' => true,
'created_by' => true,
'modified_by' => true,
]]);
try {
$result = $rolesTable->saveOrFail($role);
} catch (PersistenceFailedException $e) { // @phpstan-ignore-line
$errors = $e->getEntity()->getErrors();
throw new CustomValidationException(
__('The role could not be saved.'),
$errors
);
} catch (Exception $e) {
throw new InternalErrorException(__('Could not save the role, please try again later.'), null, $e);
}
$this->dispatchEvent(self::AFTER_ROLE_CREATE_SUCCESS_EVENT_NAME, [
'uac' => $uac,
'role' => $result,
]);
return $result;
}
}
View on GitHub (pinned to 31c1bbc10f)