passbolt/passbolt_api · error · Cake\Http\Exception\InternalErrorException

Could not save the folder relation history.

Error message

Could not save the folder relation history.

What it means

Thrown by FoldersRelationsHistoryTable::create() when save() returns false, i.e. the entity passed validation but could not be persisted (InternalErrorException). This indicates a persistence-level failure rather than invalid input.

Solutions

  1. Check the previous exception and database error logs to identify the save failure cause.
  2. Verify database connectivity and that migrations for the folders plugin are up to date.
  3. Ensure referenced entities (folder, user) still exist and the relation does not violate constraints.
  4. Retry the operation; if it recurs, run integrity cleanup on folders_relations data.
Defensive patterns

Strategy: try-catch

Try / catch

try { $table->create($data); } catch (InternalErrorException $e) { log_error($e->getPrevious()); /* retry or alert */ }

Prevention

When it happens

Trigger: save() failing due to database constraint violations (duplicate/missing referenced rows), database connection problems, or transaction/lock issues while writing the folders_relations_history row.

Common situations: Race conditions where the referenced folder or user was deleted between validation and save; database connectivity outages; FK constraint failures from inconsistent relation history data.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/b3862c5e5b9b2894. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltCe/Folders/src/Model/Table/FoldersRelationsHistoryTable.php:173

     *
     * @param array $data the data
     * @return \Passbolt\Folders\Model\Entity\FoldersRelation
     * @throws \App\Error\Exception\ValidationException
     * @throws \Cake\Http\Exception\InternalErrorException
     */
    public function create(array $data): FoldersRelation
    {
        // Check validation rules.
        $folderRelationHistory = $this->buildEntity($data);
        if ($folderRelationHistory->getErrors()) {
            $msg = __('Could not validate folders relations history data.');
            throw new ValidationException($msg, $folderRelationHistory, $this);
        }
        $folderRelationHistory = $this->save($folderRelationHistory);

        // Check for errors while saving.
        if (!$folderRelationHistory) {
            throw new InternalErrorException('Could not save the folder relation history.');
        }

        // Check for validation errors. (associated models too).
        if ($folderRelationHistory->getErrors()) {
            $msg = __('Could not validate folders relations history data.');
            throw new ValidationException($msg, $folderRelationHistory, $this);
        }

        return $folderRelationHistory;
    }
}

View on GitHub (pinned to 31c1bbc10f)