{"record":{"id":"091e67d3d977f237","repo":"passbolt/passbolt_api","slug":"could-not-save-the-rbacs-please-try-again-later","errorCode":null,"errorMessage":"Could not save the rbacs, please try again later.","messagePattern":"Could not save the rbacs, please try again later\\.","errorType":"http","errorClass":"InternalErrorException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/Rbacs/src/Event/CreateRbacsOnRoleCreateListener.php","lineNumber":108,"sourceCode":"                    'created' => true,\n                    'modified' => true,\n                    'created_by' => true,\n                    'modified_by' => true,\n                ]]\n            );\n        }\n\n        try {\n            $rbacsTable->saveManyOrFail($entities);\n        } catch (PersistenceFailedException $e) {\n            $errors = $e->getEntity()->getErrors();\n\n            throw new CustomValidationException(\n                __('The rbacs could not be saved.'),\n                $errors\n            );\n        } catch (Exception $e) {\n            throw new InternalErrorException(__('Could not save the rbacs, please try again later.'), null, $e);\n        }\n    }\n}\n","sourceCodeStart":90,"sourceCodeEnd":112,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Rbacs/src/Event/CreateRbacsOnRoleCreateListener.php#L90-L112","documentation":"Generic fallback thrown by CreateRbacsOnRoleCreateListener::createRbacsOnRoleCreate() as an InternalErrorException when saving the RBAC entities fails with any exception other than PersistenceFailedException (e.g. database connection failure, lock timeout). The original exception is chained for server-side inspection.","triggerScenarios":"Role-created event fires and $rbacsTable->saveManyOrFail() throws an unexpected exception — DB connection loss, query errors, table missing, transaction/lock issues.","commonSituations":"Database server down or unreachable during role creation, rbacs table missing due to unrun migrations, deadlock/lock wait timeout under concurrent load.","solutions":["Check the application/database error logs for the chained exception ($e) to find the root cause.","Verify database connectivity and that the rbacs table exists (run migrations).","Retry the role creation once the transient database issue is resolved.","If persistent, inspect database server health (locks, disk, max connections)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!$schema = $connection->getSchemaCollection()->describe('rbacs')) {\n    throw new RuntimeException('rbacs table missing; run migrations');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $rbacsTable->saveManyOrFail($entities);\n} catch (PersistenceFailedException $e) {\n    // validation path\n} catch (Exception $e) {\n    // transient DB issue: check connectivity, then retry with backoff\n    Log::error('rbacs save failed: ' . $e->getMessage());\n}","preventionTips":["Monitor database connectivity and health before bulk role operations.","Ensure migrations ran so the rbacs table exists.","Use retries with backoff for transient DB failures.","Watch for lock contention during concurrent role creation."],"tags":["php","cakephp","rbacs","database","internal-error"],"backgroundTag":"database-query-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"}