{"record":{"id":"ee0e72a84f8f8d50","repo":"passbolt/passbolt_api","slug":"it-is-not-possible-to-save-the-sso-settings","errorCode":null,"errorMessage":"It is not possible to save the SSO settings.","messagePattern":"It is not possible to save the SSO settings\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":422,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php","lineNumber":91,"sourceCode":"                'created_by' => $uac->getId(),\n                'modified_by' => $uac->getId(),\n            ],\n            [\n                'accessibleFields' => [\n                    'provider' => true,\n                    'status' => true,\n                    'data' => true,\n                    'created_by' => true,\n                    'modified_by' => true,\n                ],\n            ]\n        );\n\n        // Check for validation or build rules errors\n        $errors = $ssoSettingEntity->getErrors();\n        if (!empty($errors) || !$ssoSettingsTable->save($ssoSettingEntity)) {\n            $msg = __('It is not possible to save the SSO settings.');\n            throw new ValidationException($msg, $ssoSettingEntity, $ssoSettingsTable);\n        }\n\n        return new SsoSettingsDto($ssoSettingEntity, $data['data']);\n    }\n\n    /**\n     * @param string $provider provider name\n     * @param array $data provider configuration data\n     * @return string\n     */\n    protected function serializeData(string $provider, array $data): string\n    {\n        $dataDto = SsoSettingsDto::ssoSettingsDataDtoFactory($provider, $data);\n\n        $result = json_encode($dataDto->toArray());\n        if (!$result) {\n            throw new InternalErrorException(__('It is not possible to save the SSO settings.'));\n        }","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php#L73-L109","documentation":"After form validation, create() builds the SsoSetting entity and saves it via the table; if the entity has validation/application-rule errors or save() returns false, it throws ValidationException 'It is not possible to save the SSO settings.' carrying the entity's errors. This indicates persistence-level failure rather than form-level validation.","triggerScenarios":"Database constraint violations (e.g. uniqueness rules on active settings), build rules failing on the table, database connectivity/schema issues causing save() to return false with errors set.","commonSituations":"Another active SSO settings record conflicts with the one being saved; DB migration not run so columns are missing; duplicate concurrent draft creation by two admins; database in read-only/troubled state.","solutions":["Read the entity errors attached to the ValidationException to identify the failing field or rule.","Run pending migrations (ddev refresh / bin/cake migrations migrate) so the sso_settings schema is current.","Resolve conflicting records (e.g. delete or complete an existing draft/active settings that violates uniqueness rules).","Check database connectivity/health if save() fails without field errors (DB down, disk full, lock timeouts)."],"exampleFix":"// before\n$data = $form->getData(); // saved with stale duplicate draft present -> build rule fails\n// after\n$existing = $service->getDraftByIdOrFail($draftId); // complete/delete existing draft first\n$service->create($uac, $data);","handlingStrategy":"try-catch","validationCode":"// check for conflicting existing records before saving\n$existingActive = $settingsTable->find()->where(['status' => 'active'])->count();\n$duplicateDrafts = $settingsTable->find()->where(['status' => 'draft'])->all();","typeGuard":null,"tryCatchPattern":"try { $service->create($uac, $data); } catch (ValidationException $e) { $entityErrors = $e->getEntity()->getErrors(); // fix rule violations or DB state }","preventionTips":["Run migrations after upgrading so the sso_settings schema is current","Complete or delete stale drafts before creating new settings","Inspect entity errors on the exception before retrying","Monitor database health (connectivity, locks, disk) for unexplained save failures"],"tags":["sso","database","persistence","validation"],"backgroundTag":"database-write-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"}