passbolt/passbolt_api · error · InternalErrorException
Invalid request, message validation rules are missing.
Error message
Invalid request, message validation rules are missing.
What it means
MessageValidationService::parseAndValidateMessage validates an armored OpenPGP message against a set of rules (has-key-id, has-exactly-one-recipient, etc.). If the caller passes null rules AND the default rules resolve to an empty array, an InternalErrorException is thrown because running with zero validation rules is an invariant violation / misconfiguration.
Solutions
- Verify passbolt.gpg configuration (server key fingerprint, keyring) so getDefaultRules() returns rules.
- Pass an explicit non-empty $rules array when calling parseAndValidateMessage directly.
- Run `ddev refresh` / healthcheck to confirm GPG setup is valid.
- Check for custom code filtering out all default rules.
Example fix
// before MessageValidationService::parseAndValidateMessage($armored, []); // after MessageValidationService::parseAndValidateMessage($armored, [MessageValidationService::IS_PARSABLE_ARMORED_MESSAGE_RULE]);
Defensive patterns
Strategy: validation
Validate before calling
$rules = $rules ?? MessageValidationService::getDefaultRules();
if (!count($rules)) { throw new LogicException('no rules configured'); } Try / catch
try { parseAndValidateMessage($msg, $rules); } catch (InternalErrorException $e) { /* fix GPG config */ } Prevention
- Keep passbolt.gpg server key config valid
- Run healthcheck to verify GPG setup
- Never pass empty rule arrays
When it happens
Trigger: Calling parseAndValidateMessage() (or via the validation middleware __invoke) when getDefaultRules() returns an empty array — e.g. GPG server key configuration missing so required default rules (from passbolt.gpg config) are not generated.
Common situations: Misconfigured passbolt.php GPG key settings, environment where the server key fingerprint is not set, overridden rules arrays accidentally emptied by integrations.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- A valid OpenPGP key must be provided.
- Could not validate message data.
- Could not validate user data.
- The armored message could not be validated.
- The config for the server private key fingerprint is not…
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/fce7b137785a655d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Service/OpenPGP/MessageValidationService.php:88
*/
public static function getAsymmetricMessageRules(): array
{
return array_merge(self::getDefaultRules(), [
self::HAS_ASYMMETRIC_PACKET_RULE,
self::HAS_EXACTLY_ONE_RECIPIENT,
]);
}
/**
* @param string $armoredMessage user provided data
* @param array|null $rules to override default rules
* @return array key information (see OpenPGPBackendInterface::getKeyInfo)
*/
public static function parseAndValidateMessage(string $armoredMessage, ?array $rules = null): array
{
$rules = $rules ?? self::getDefaultRules();
if (!count($rules)) {
throw new InternalErrorException('Invalid request, message validation rules are missing.');
}
// Parsing check is mandatory and always done first
// We don't even try the other rules if this one fails
try {
$messageInfo = self::getMessageInfo($armoredMessage);
} catch (Exception $exception) {
throw new CustomValidationException(__('The public key could not be parsed.'), [
'data' => [
self::IS_PARSABLE_ARMORED_MESSAGE_RULE => $exception->getMessage(),
],
]);
}
// Other rules are recommended but not mandatory
// As one may want to see what's inside the message info for debugging purpose
$validationErrors = [];
foreach ($rules as $ruleName) {View on GitHub (pinned to 31c1bbc10f)