passbolt/passbolt_api · critical · InternalErrorException
The metadata private key could not be created. Please try…
Error message
The metadata private key could not be created. Please try again later.
What it means
Thrown by MetadataPrivateKeysCreateService::create when saving the MetadataPrivateKey entity returns false with no validation errors recorded. It is an InternalErrorException meaning the persistence layer failed for a non-validation reason, so the user is told to retry later.
Solutions
- Retry the request after a short delay, as the message suggests
- Check the database is reachable and healthy (connection, disk space, locks)
- Inspect server/application logs around the failure time for the underlying DB exception
- Verify the metadata key and user rows exist and no unique constraints are violated
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
catch (e) { if (e.response?.status === 500 && /could not be created/.test(e.response?.body?.message)) { await delay(1000); return retryOnce(); } throw e; } Prevention
- Monitor database health and connectivity
- Avoid concurrent admin operations on the same metadata key
- Check server logs immediately when this appears to find the chained root cause
When it happens
Trigger: save() on MetadataPrivateKeysTable returns false without entity errors — typically a database error (constraint, connection, lock timeout) during creation of a server or user metadata private key.
Common situations: Database down or connection dropped mid-request; DB constraint conflicts not surfaced as validation errors; disk full on the DB server; concurrent admin operations racing on the same metadata key.
Related errors
- Could not save the comment, please try again later.
- Could not save the user data. Please try again later.
- The metadata private keys could not be created.
- Could not delete the resource. Please try again later.
- Could not ignore the record, please try again later.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/30bd907097fa51ba.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Metadata/src/Service/MetadataPrivateKeysCreateService.php:86
'metadata_key_id' => true,
'user_id' => true,
'data' => true,
'created_by' => true,
'modified_by' => true,
],
]);
if (!empty($metadataPrivateKey->getErrors())) {
$this->handleValidationErrors($metadataPrivateKey, $metadataPrivateKeysTable);
}
$created = $metadataPrivateKeysTable->save($metadataPrivateKey);
if ($created === false) {
if (!empty($metadataPrivateKey->getErrors())) {
$this->handleValidationErrors($metadataPrivateKey, $metadataPrivateKeysTable);
}
$msg = __('The metadata private key could not be created.') . ' ';
$msg .= __('Please try again later.');
throw new InternalErrorException($msg);
}
return $created;
}
/**
* Handle validation or build rules failure
*
* @param \Passbolt\Metadata\Model\Entity\MetadataPrivateKey $entity that is failing the validation
* @param \Passbolt\Metadata\Model\Table\MetadataPrivateKeysTable $table table
* @throws \App\Error\Exception\ValidationException
* @return void
*/
protected function handleValidationErrors(MetadataPrivateKey $entity, MetadataPrivateKeysTable $table): void
{
if (Configure::read('debug')) {
Log::error(json_encode($entity->getErrors()));
}View on GitHub (pinned to 31c1bbc10f)