passbolt/passbolt_api · error · ValidationException
The metadata private key could not be validated.
Error message
The metadata private key could not be validated.
What it means
ValidationException raised by handleValidationErrors when the patched entity has validation errors but the save failed silently. In debug mode the entity errors are logged to the error log; otherwise only the generic message is returned. It signals the payload failed table validation rules at save time.
Solutions
- Enable debug mode temporarily and check the error log for the JSON-encoded entity errors to see which fields failed.
- Fix the `data` payload so it satisfies the server's validation rules (valid OpenPGP/encrypted message format).
- Update the client to the version matching the server's metadata feature requirements.
Example fix
// before
{"data": ""}
// after
{"data": "-----BEGIN PGP MESSAGE-----..."} Defensive patterns
Strategy: validation
Validate before calling
// PHP: mirror table rules before calling
if (!is_string($data['data']) || trim($data['data']) === '') {
throw new \InvalidArgumentException('data must be a non-empty string');
} Try / catch
catch (ValidationException $e) {
$errors = $e->getErrors(); // entity + field errors
// fix the offending field and retry once
} Prevention
- Ensure `data` matches the expected OpenPGP encrypted message format
- Enable debug logging in staging to capture entity errors
- Re-encrypt with supported schemes after server upgrades
When it happens
Trigger: PUT of a metadata private key whose `data` fails validation rules defined on MetadataPrivateKeysTable (e.g. empty string, not valid OpenPGP message) after passing the service-level string check.
Common situations: Client sending data encrypted with an unsupported scheme after a server upgrade; data exceeding column length; new server validation rules rejecting legacy payloads.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- The metadata session key could not be saved.
- The request data is invalid.
- " " is not a valid search filter.
- " " is not a valid search filter. It is not a UTF8 string.
- " " is not a valid search filter. It should be between 1…
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/c316b980bcd0ab92.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Metadata/src/Service/MetadataPrivateKeysUpdateService.php:112
return $updated;
}
/**
* 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
*/
public function handleValidationErrors(MetadataPrivateKey $entity, MetadataPrivateKeysTable $table): void
{
if (Configure::read('debug')) {
Log::error(json_encode($entity->getErrors()));
}
$msg = __('The metadata private key could not be validated.');
throw new ValidationException($msg, $entity, $table);
}
}
View on GitHub (pinned to 31c1bbc10f)