{"record":{"id":"b49bfae6d35e18b7","repo":"passbolt/passbolt_api","slug":"could-not-update-the-sso-settings","errorCode":null,"errorMessage":"Could not update the SSO settings.","messagePattern":"Could not update the SSO settings\\.","errorType":"exception","errorClass":"InternalErrorException","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsActivateService.php","lineNumber":97,"sourceCode":"\n        // If token is not found remap error, not found in this context is reserved for settings\n        try {\n            $ssoAuthToken = $authTokenService->getOrFail($data['token'] ?? '', $type);\n        } catch (RecordNotFoundException $exception) {\n            throw new BadRequestException($exception->getMessage(), 400, $exception);\n        }\n\n        // Consume or be consumed\n        $authTokenService->assertAndConsume($ssoAuthToken, $uac, $ssoSettingEntity->id);\n\n        // Activate\n        try {\n            $ssoSettingEntity->status = SsoSetting::STATUS_ACTIVE;\n            $ssoSettingEntity->modified_by = $uac->getId();\n            $this->SsoSettings->save($ssoSettingEntity);\n            (new SsoSettingsDeleteService())->deleteAllBut($id);\n        } catch (Exception $exception) {\n            throw new InternalErrorException(__('Could not update the SSO settings.'), 500, $exception);\n        }\n\n        // Notify settings have been changed\n        $event = new Event(\n            self::AFTER_ACTIVATE_SSO_SETTINGS_EVENT,\n            $this,\n            ['uac' => $uac, 'ssoSetting' => $ssoSettingEntity]\n        );\n        $this->SsoSettings->getEventManager()->dispatch($event);\n\n        // Return new updated setting\n        return (new SsoSettingsGetService())->getActiveOrFail(true);\n    }\n\n    /**\n     * @param string $id uuid\n     * @param string $status for example SsoSetting::STATUS_ACTIVE\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if the settings id is not a uuid","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsActivateService.php#L79-L115","documentation":"Thrown when persisting the activated SSO settings (setting status to active, modified_by) or deleting all other settings fails with a generic exception inside SsoSettingsActivateService::activate(). It wraps the original exception as an InternalErrorException (500), indicating a server-side persistence problem rather than invalid input.","triggerScenarios":"Database failure during SsoSettings->save(), a validation error on the entity (e.g. modified_by id invalid), or an exception from SsoSettingsDeleteService::deleteAllBut() during activation.","commonSituations":"Database connection loss or lock timeouts mid-request; schema drift after an incomplete migration; modified_by pointing to a deleted user; concurrent activation races deleting the same rows.","solutions":["Inspect the wrapped previous exception in the server logs for the root cause","Run pending migrations (bin/cake migrations_run / ddev refresh) to fix schema drift","Retry activation once the database is healthy; verify the acting user still exists"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { $service->activate($uac, $id, $data); } catch (InternalErrorException $e) { Log::error($e->getPrevious()); // alert/retry }","preventionTips":["Keep migrations up to date","Monitor DB connectivity during admin operations","Verify the acting UAC user exists before activating"],"tags":["sso","database","internal-error","passbolt"],"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"}