passbolt/passbolt_api · error · InternalErrorException

Could not validate the self registration settings found in…

Error message

Could not validate the self registration settings found in database.

What it means

Thrown by SelfRegistrationGetSettingsService::getSettings when the JSON stored in the database parses but fails validation against the SelfRegistration form (getFormFromData + $form->execute). The FormValidationException is wrapped in an InternalErrorException (HTTP 500). It means stored settings no longer satisfy current validation rules.

Solutions

  1. Read the validation errors from the wrapped FormValidationException to see which fields fail, then correct the stored JSON accordingly.
  2. Re-save the settings through the API (PUT /self-registration) so they are re-validated on write.
  3. Delete the settings row to fall back to defaults, then reconfigure via the UI/API.
  4. Check the passbolt changelog for changed self-registration validation after an upgrade.

Example fix

// before (stored settings with removed provider value)
{"providers":["email","token"],"email_domains":["passbolt.com"]}

// after: only values valid under current rules
{"providers":["email"],"email_domains":["passbolt.com"]}
Defensive patterns

Strategy: try-catch

Validate before calling

$data = json_decode($storedValue, true);
$form = new SelfRegistrationEmailConfigurationForm(); // same form used internally
if (!$form->check($data)) { /* fix stored settings before read */ }

Try / catch

try {
    $settings = $service->getSettings();
} catch (FormValidationException | InternalErrorException $e) {
    Log::warning('Stored self-registration settings invalid: ' . $e->getMessage());
    $settings = $defaultSettings;
}

Prevention

When it happens

Trigger: GET /self-registration.json is called while the stored settings JSON passes json_decode but the form's validation (e.g. invalid providers list, missing required fields, invalid email domain) rejects the data.

Common situations: Settings written by an older passbolt version whose schema differs from current validation rules; manually edited DB rows; code upgrades that added stricter validation rules after settings were saved.

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


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/f2f6f04821bd342a. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltCe/SelfRegistration/src/Service/SelfRegistrationGetSettingsService.php:55

        $settings = $OrganizationSettings->getByProperty(self::USER_SELF_REGISTRATION_SETTINGS_PROPERTY_NAME);
        if (is_null($settings)) {
            return $this->getDefaultSettings();
        }

        $value = json_decode($settings->get('value'), true);
        if (is_null($value)) {
            throw new InternalErrorException(
                __('Could not parse the self registration settings found in database.')
            );
        }
        $form = $this->getFormFromData($value);
        if (!$form->execute($value)) {
            $validationException = new FormValidationException(
                __('Could not validate the self registration settings found in database.'),
                $form
            );

            throw new InternalErrorException($validationException->getMessage(), 500, $validationException);
        }

        return $this->getRenderedValue($settings, $form);
    }

    /**
     * @return array<null>
     */
    protected function getDefaultSettings(): array
    {
        return [
            'provider' => null,
            'data' => null,
        ];
    }
}

View on GitHub (pinned to 31c1bbc10f)