passbolt/passbolt_api · error · InternalErrorException
Could not save the action.
Error message
Could not save the action.
What it means
ActionsTable::create() throws this InternalErrorException when save() returns false without producing validation errors on the entity. It indicates an infrastructure-level write failure rather than invalid data.
Solutions
- Check error.log / DB logs for the real reason save() returned false.
- Run pending migrations to align the actions table schema.
- Verify DB connectivity, credentials, and disk space on the database host.
- Audit plugins for beforeSave/applicationRules returning false without setting entity errors.
Example fix
// before
$actionSaved = $this->save($action);
if (!$actionSaved) {
throw new InternalErrorException('Could not save the action.');
}
// after
$actionSaved = $this->save($action);
if (!$actionSaved) {
$this->log('Action save failed: ' . json_encode($action->getErrors()), 'error');
throw new InternalErrorException('Could not save the action.');
} Defensive patterns
Strategy: retry
Validate before calling
try { $this->getConnection()->query('SELECT 1'); } catch (\Throwable $e) { // DB unavailable: skip logging path } Type guard
null
Try / catch
try { $action = $actionsTable->create($data); } catch (InternalErrorException $e) { // transient DB failure: retry once, then log and continue
retry: $action = @$actionsTable->create($data) ?? null;
if (!$action) { Log::error('Action persistence failed: ' . $e->getMessage()); }
} Prevention
- Run migrations after every upgrade.
- Set up DB monitoring for outages, locks, and disk pressure.
- Keep save-affecting event listeners on Actions minimal and error-setting.
- Isolate audit-log failures from the main request path.
When it happens
Trigger: create() called by findOrCreateAction() with valid data, but the INSERT fails: DB connection lost, missing/corrupted actions table, deadlock, or a beforeSave callback returning false without setting errors.
Common situations: Migrations not applied after upgrade; database outage or connection-pool exhaustion during heavy logging; disk-full; custom event listeners aborting save silently.
Related errors
- Could not save the action log.
- Could not save the entity history.
- The data could not be saved. Metadata key could not be…
- New directory settings could not be saved.
- Could not parse the self registration settings found in…
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/b6f6e100dd1f305e.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Log/src/Model/Table/ActionsTable.php:140
];
// Check validation rules.
$action = $this->buildEntity($data);
if ($action->getErrors()) {
throw new ValidationException(__('Could not validate action data.', true), $action, $this);
}
/** @var \Passbolt\Log\Model\Entity\Action $actionSaved */
$actionSaved = $this->save($action);
// Check for validation errors.
if ($action->getErrors()) {
throw new ValidationException(__('Could not validate action data.'), $action, $this);
}
// Check for errors while saving.
if (!$actionSaved) {
throw new InternalErrorException('Could not save the action.');
}
return $actionSaved;
}
/**
* Get cached actions.
*
* @return \Cake\Datasource\ResultSetInterface
*/
public function getCachedActions(): ResultSetInterface
{
$actions = $this->find()
->cache(self::CACHE_KEY)
->all();
return $actions;
}View on GitHub (pinned to 31c1bbc10f)