passbolt/passbolt_api · critical · InternalErrorException
Could not save the metadata session key, please try again…
Error message
Could not save the metadata session key, please try again later.
What it means
InternalErrorException thrown when an unexpected (non-persistence) Exception escapes during metadata session key creation. It wraps the original exception and tells the caller the failure is server-side and possibly transient.
Solutions
- Retry after a short delay; the error is often transient.
- Inspect the server error log for the wrapped original exception (chained via the third constructor argument).
- Verify DB connectivity and plugin/event listener health; run `ddev refresh` after upgrades.
- If reproducible, debug beforeSave/beforeMarshal rules on MetadataSessionKeysTable.
Defensive patterns
Strategy: retry
Try / catch
catch (InternalErrorException $e) {
Log::error($e->getPrevious()?->getMessage()); // chained root cause
// backoff and retry once; otherwise surface to ops
} Prevention
- Log the chained previous exception for root cause
- Monitor database availability and health
- Run `ddev refresh` / migrations after upgrades
- Exercise beforeSave listeners in tests
When it happens
Trigger: create() hits an exception other than PersistenceFailedException — DB connection loss, driver errors, exceptions thrown in beforeSave/beforeMarshal callbacks, or serialization issues.
Common situations: Database temporarily unreachable; a plugin's event listener throwing; disk/resource exhaustion on the server; cross-database SQL incompatibility in a custom rule.
Related errors
- Could not save the metadata session keys, please try again…
- Could not save the rbacs, please try again later.
- The metadata private key could not be updated. Please try…
- 500
- Could not create the folder, please try again later.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/04d91dd5adf52109.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Metadata/src/Service/MetadataSessionKeyCreateService.php:59
/** @var \Passbolt\Metadata\Model\Table\MetadataSessionKeysTable $metadataSessionKeysTable */
$metadataSessionKeysTable = $this->fetchTable('Passbolt/Metadata.MetadataSessionKeys');
$metadataSessionKey = $metadataSessionKeysTable->newEntity(
['user_id' => $uac->getId(), 'data' => $data],
['accessibleFields' => ['user_id' => true, 'data' => true]]
);
try {
/** @var \Passbolt\Metadata\Model\Entity\MetadataSessionKey $result */
$result = $metadataSessionKeysTable->saveOrFail($metadataSessionKey);
} catch (PersistenceFailedException $e) { // @phpstan-ignore-line
$errors = $e->getEntity()->getErrors();
throw new CustomValidationException(
__('The metadata session key could not be saved.'),
$errors
);
} catch (Exception $e) {
throw new InternalErrorException(
__('Could not save the metadata session key, please try again later.'),
null,
$e
);
}
return $result;
}
/**
* Basic sanity check for the given data value.
*
* @param mixed $data Data to check.
* @return void
*/
private function assertData(mixed $data): void
{
if (!is_string($data)) {View on GitHub (pinned to 31c1bbc10f)