{"record":{"id":"34cad52d70a6ed8a","repo":"passbolt/passbolt_api","slug":"could-not-save-the-ui-action-try-again-later","errorCode":null,"errorMessage":"Could not save the UI action, try again later.","messagePattern":"Could not save the UI action, try again later\\.","errorType":"http","errorClass":"InternalErrorException","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltCe/Rbacs/src/Service/UiActions/UiActionsCreateService.php","lineNumber":72,"sourceCode":"        ]]);\n\n        // Check for validation errors\n        if ($entity->getErrors()) {\n            $msg = __('The UI actions data could not be validated.');\n            throw new ValidationException($msg, $entity, $this->uiActionsTable);\n        }\n\n        // Check business rules\n        $this->uiActionsTable->checkRules($entity);\n        if ($entity->getErrors()) {\n            $msg = __('The UI actions data could not be validated.');\n            throw new ValidationException($msg, $entity, $this->uiActionsTable);\n        }\n\n        // Check for internal error on save\n        $entity = $this->uiActionsTable->save($entity, ['checkRules' => false]);\n        if (!$entity) {\n            throw new InternalErrorException('Could not save the UI action, try again later.');\n        }\n\n        return $entity;\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":78,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Rbacs/src/Service/UiActions/UiActionsCreateService.php#L54-L78","documentation":"After validation and rules checks pass, UiActionsCreateService::create() calls UiActionsTable::save(). If save() returns false (the ORM could not persist the row despite checkRules being disabled), the service throws Cake\\Http\\Exception\\InternalErrorException with 'Could not save the UI action, try again later.' — signaling an unexpected persistence failure, not a client input problem.","triggerScenarios":"$this->uiActionsTable->save($entity, ['checkRules' => false]) returns false or null — e.g. a database connection failure, a lock/timeout, a schema mismatch (migration not run so ui_actions table or columns are missing), or a unique-constraint race where another request inserted the same name between checkRules and save.","commonSituations":"Migrations not applied after upgrading (table missing), database down or read-only replica, concurrent insert of the same action name, disk full or DB connection dropped mid-request.","solutions":["Run pending migrations (ddev refresh / bin/cake migrations migrate) to ensure the ui_actions schema exists.","Check database connectivity and logs (error.log) for the underlying SQL error that made save() fail.","Catch Cake\\Http\\Exception\\InternalErrorException and surface a 500 to the client with retry guidance; the message explicitly says 'try again later'.","For duplicate-name races, retry once after re-checking existence, or rely on the unique rule before save.","Verify the database user has INSERT privileges on ui_actions."],"exampleFix":"// before\ntry { $service->create($name); }\n// after\ntry {\n    $service->create($name);\n} catch (\\Cake\\Http\\Exception\\InternalErrorException $e) {\n    // inspect logs for the real DB failure, then retry or report 500\n}","handlingStrategy":"retry","validationCode":"if (!TableRegistry::getTableLocator()->get('Passbolt/Rbacs.UiActions')->getConnection()->isConnected()) { /* abort or reconnect */ }","typeGuard":null,"tryCatchPattern":"try { $service->create($name); } catch (\\Cake\\Http\\Exception\\InternalErrorException $e) { \\Cake\\Log\\Log::error($e->getMessage()); /* retry later or return 500 */ }","preventionTips":["Keep migrations up to date so the ui_actions schema exists","Monitor database availability and locks before bulk seeding","Log the underlying DB error (error.log) — save() returning false hides the cause","Serialize/lock bulk insert jobs to avoid duplicate-name races"],"tags":["php","database","save-failure","cakephp"],"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"}