{"record":{"id":"f2f6f04821bd342a","repo":"passbolt/passbolt_api","slug":"could-not-validate-the-self-registration-settings-found-in","errorCode":null,"errorMessage":"Could not validate the self registration settings found in database.","messagePattern":"Could not validate the self registration settings found in database\\.","errorType":"exception","errorClass":"InternalErrorException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/SelfRegistration/src/Service/SelfRegistrationGetSettingsService.php","lineNumber":55,"sourceCode":"        $settings = $OrganizationSettings->getByProperty(self::USER_SELF_REGISTRATION_SETTINGS_PROPERTY_NAME);\n        if (is_null($settings)) {\n            return $this->getDefaultSettings();\n        }\n\n        $value = json_decode($settings->get('value'), true);\n        if (is_null($value)) {\n            throw new InternalErrorException(\n                __('Could not parse the self registration settings found in database.')\n            );\n        }\n        $form = $this->getFormFromData($value);\n        if (!$form->execute($value)) {\n            $validationException = new FormValidationException(\n                __('Could not validate the self registration settings found in database.'),\n                $form\n            );\n\n            throw new InternalErrorException($validationException->getMessage(), 500, $validationException);\n        }\n\n        return $this->getRenderedValue($settings, $form);\n    }\n\n    /**\n     * @return array<null>\n     */\n    protected function getDefaultSettings(): array\n    {\n        return [\n            'provider' => null,\n            'data' => null,\n        ];\n    }\n}\n","sourceCodeStart":37,"sourceCodeEnd":72,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/SelfRegistration/src/Service/SelfRegistrationGetSettingsService.php#L37-L72","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the validation errors from the wrapped FormValidationException to see which fields fail, then correct the stored JSON accordingly.","Re-save the settings through the API (PUT /self-registration) so they are re-validated on write.","Delete the settings row to fall back to defaults, then reconfigure via the UI/API.","Check the passbolt changelog for changed self-registration validation after an upgrade."],"exampleFix":"// before (stored settings with removed provider value)\n{\"providers\":[\"email\",\"token\"],\"email_domains\":[\"passbolt.com\"]}\n\n// after: only values valid under current rules\n{\"providers\":[\"email\"],\"email_domains\":[\"passbolt.com\"]}","handlingStrategy":"try-catch","validationCode":"$data = json_decode($storedValue, true);\n$form = new SelfRegistrationEmailConfigurationForm(); // same form used internally\nif (!$form->check($data)) { /* fix stored settings before read */ }","typeGuard":null,"tryCatchPattern":"try {\n    $settings = $service->getSettings();\n} catch (FormValidationException | InternalErrorException $e) {\n    Log::warning('Stored self-registration settings invalid: ' . $e->getMessage());\n    $settings = $defaultSettings;\n}","preventionTips":["Always save settings through the validated API endpoints.","After upgrading passbolt, re-save self-registration settings to conform to new rules.","Run the settings round-trip (save then get) in your deployment smoke tests.","Monitor logs for FormValidationException on read paths."],"tags":["database","validation","configuration","cakephp"],"backgroundTag":"schema-validation-failed","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}