{"record":{"id":"cbc5e949c217435f","repo":"passbolt/passbolt_api","slug":"could-not-validate-the-user-passphrase-policies-settings","errorCode":null,"errorMessage":"Could not validate the user passphrase policies settings.","messagePattern":"Could not validate the user passphrase policies settings\\.","errorType":"validation","errorClass":"FormValidationException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/UserPassphrasePolicies/src/Service/UserPassphrasePoliciesGetSettingsService.php","lineNumber":51,"sourceCode":"     * @return \\Passbolt\\UserPassphrasePolicies\\Model\\Dto\\UserPassphrasePoliciesSettingsDto\n     * @throws \\App\\Error\\Exception\\FormValidationException When settings could not validate\n     */\n    public function get(): UserPassphrasePoliciesSettingsDto\n    {\n        /** @var \\Passbolt\\UserPassphrasePolicies\\Model\\Table\\UserPassphrasePoliciesSettingsTable $userPassphrasePoliciesSettingsTable */\n        $userPassphrasePoliciesSettingsTable = $this->fetchTable('Passbolt/UserPassphrasePolicies.UserPassphrasePoliciesSettings'); // phpcs:ignore\n\n        /** @var \\Passbolt\\UserPassphrasePolicies\\Model\\Entity\\UserPassphrasePoliciesSetting|null $userPassphrasePoliciesSetting */\n        $userPassphrasePoliciesSetting = $userPassphrasePoliciesSettingsTable->find()->first();\n\n        // Fallback to default settings if no data in database\n        if (is_null($userPassphrasePoliciesSetting)) {\n            return UserPassphrasePoliciesSettingsDto::createFromDefault();\n        }\n\n        $form = new UserPassphrasePoliciesSettingsForm();\n        if (!$form->execute($userPassphrasePoliciesSetting->value)) {\n            throw new FormValidationException(\n                __('Could not validate the user passphrase policies settings.'),\n                $form\n            );\n        }\n\n        return UserPassphrasePoliciesSettingsDto::createFromEntity($userPassphrasePoliciesSetting);\n    }\n}\n","sourceCodeStart":33,"sourceCodeEnd":60,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/UserPassphrasePolicies/src/Service/UserPassphrasePoliciesGetSettingsService.php#L33-L60","documentation":"UserPassphrasePoliciesGetSettingsService::get validates the stored settings value against UserPassphrasePoliciesSettingsForm. If a settings record exists in organization settings but its stored value array fails the form's rules, it throws this FormValidationException carrying the form's error list.","triggerScenarios":"Reading user passphrase policies settings when the persisted value in organization_settings fails UserPassphrasePoliciesSettingsForm validation (e.g. invalid source, wrong types, missing/invalid fields such as length or entropy minimums).","commonSituations":"Settings saved by a different plugin/client version with an out-of-date schema; manually edited database rows; settings written by a newer passbolt version then read by an older one.","solutions":["Look at the form errors attached to the FormValidationException to see which fields are invalid.","Re-save the settings with the current API (POST user passphrase policies settings) so the value is rewritten in the expected format.","As a last resort remove the stale organization_settings record so the service falls back to createFromDefault()."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return $service->get(); } catch (FormValidationException $e) { return UserPassphrasePoliciesSettingsDto::createFromDefault(); }","preventionTips":["Re-save settings through the current API after version upgrades.","Avoid direct DB edits to organization settings.","Catch FormValidationException and fall back to default settings with an admin warning."],"tags":["user-passphrase-policies","settings","validation"],"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"}