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

  1. Retry the request after a short delay, as the message suggests
  2. Check the database is reachable and healthy (connection, disk space, locks)
  3. Inspect server/application logs around the failure time for the underlying DB exception
  4. 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

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


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)