{"record":{"id":"8469c60b8ab0bf74","repo":"passbolt/passbolt_api","slug":"could-not-delete-the-draft-sso-settings","errorCode":null,"errorMessage":"Could not delete the draft SSO settings.","messagePattern":"Could not delete the draft SSO settings\\.","errorType":"exception","errorClass":"InternalErrorException","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsDeleteService.php","lineNumber":97,"sourceCode":"        }\n    }\n\n    /**\n     * Delete all draft settings\n     *\n     * @param string $id uuid\n     * @throws \\Cake\\Http\\Exception\\InternalErrorException if the settings could not be deleted\n     * @return void\n     */\n    public function deleteAllBut(string $id): void\n    {\n        try {\n            $ssoSettingsTable = TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoSettings');\n            $ssoSettingsTable->deleteQuery()\n                ->where(['id <>' => $id])\n                ->execute();\n        } catch (Exception $exception) {\n            throw new InternalErrorException(__('Could not delete the draft SSO settings.'), 500, $exception);\n        }\n    }\n}\n","sourceCodeStart":79,"sourceCodeEnd":101,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsDeleteService.php#L79-L101","documentation":"deleteAllBut() removes every SSO settings row whose id differs from the kept $id (used after activating one policy to purge other drafts). Any exception in that bulk delete is wrapped as InternalErrorException 'Could not delete the draft SSO settings.'","triggerScenarios":"Bulk DELETE ... WHERE id <> :id failing due to database errors, FK constraints on related sso tables, or connection loss — raised indirectly when activate() calls deleteAllBut().","commonSituations":"Orphaned rows referencing settings blocking the delete; long-running lock on the table from another transaction; schema drift after partial migrations.","solutions":["Inspect the wrapped previous exception for the failing SQL/row","Clear orphaned related rows (sso_states, auth tokens) then retry","Run migrations and retry activation; consider chunked deletes for large tables"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { (new SsoSettingsDeleteService())->deleteAllBut($id); } catch (InternalErrorException $e) { Log::error($e->getPrevious()); // cleanup orphans, retry }","preventionTips":["Clean orphaned sso related rows regularly","Keep table transactions short to avoid lock timeouts","Run migrations before activation flows"],"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"}