passbolt/passbolt_api · error · FormValidationException
Could not validate the settings.
Error message
Could not validate the settings.
What it means
Thrown by SecretRevisionsSettingsAssertService::assert when the SecretRevisionsSettingsForm does not validate the submitted settings payload. FormValidationException carries the form so callers can read per-field errors. The plugin requires settings to pass its declared schema before they are stored.
Solutions
- Call the GET settings endpoint or inspect form errors to see the exact failing fields
- Ensure all required keys (e.g. the plugin-enabled flag and numeric options) are present and correctly typed
- Resend the full settings payload rather than a partial patch
- Check the SecretRevisionsSettingsForm rules for the expected structure
Example fix
// before $service->assert(['maximum_revisions' => 'ten']); // after $service->assert(['maximum_revisions' => 10]);
Defensive patterns
Strategy: validation
Validate before calling
const required = ['maximum_revisions']; // per SecretRevisionsSettingsForm
const payloadOk = typeof payload === 'object' && required.every(k => k in payload);
if (!payloadOk) throw new Error('settings payload missing required fields'); Type guard
if (!is_array($data) || empty($data)) { throw new BadRequestException('Settings payload required'); } Try / catch
try {
$dto = $assertService->assert($data);
} catch (FormValidationException $e) {
$errors = $e->getForm()->getErrors(); // show per-field messages to the caller
} Prevention
- Send the complete settings payload, not partial patches
- Match key names exactly to the form definition
- Test payloads against the form rules in a unit test
- Check GET settings first to mirror the expected structure
When it happens
Trigger: POST/PUT to the secret revisions settings endpoints with a payload that fails SecretRevisionsSettingsForm rules (e.g. missing required keys, invalid values for thresholds like maximum_revisions, wrong types).
Common situations: API clients sending snake_case vs camelCase keys incorrectly; omitting required fields when updating only part of the settings; older clients sending fields removed in a newer plugin version.
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
- Could not validate the password expiry settings.
- Could not validate the password expiry settings.
- Could not validate the settings.
- Could not validate the smtp settings.
- Could not validate the user passphrase policies settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/d84dcc8fae8d4ffa.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/SecretRevisions/src/Service/SecretRevisionsSettingsAssertService.php:39
use Passbolt\SecretRevisions\Form\SecretRevisionsSettingsForm;
use Passbolt\SecretRevisions\Model\Dto\SecretRevisionsSettingsDto;
class SecretRevisionsSettingsAssertService
{
use LocatorAwareTrait;
/**
* Validate secret revision settings.
*
* @param array $data Data to assert.
* @return \Passbolt\SecretRevisions\Model\Dto\SecretRevisionsSettingsDto DTO.
* @throws \App\Error\Exception\FormValidationException Data does not validate.
*/
public function assert(array $data): SecretRevisionsSettingsDto
{
$form = new SecretRevisionsSettingsForm();
if (!$form->execute($data)) {
throw new FormValidationException(__('Could not validate the settings.'), $form);
}
return SecretRevisionsSettingsDto::fromArray($form->getData());
}
}
View on GitHub (pinned to 31c1bbc10f)