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

Could not create the folder, please try again later.

Error message

Could not create the folder, please try again later.

What it means

Thrown by FoldersCreateService::createPermission() when the owner Permission row for the new folder cannot be created, wrapping the underlying exception in an InternalErrorException. It indicates an unexpected server-side failure, not a user input problem.

Solutions

  1. Check the wrapped exception ($error) and server logs for the root database/validation cause.
  2. Verify the permissions table schema/migrations are current (ddev refresh / run migrations).
  3. Confirm the user (aro_foreign_key) exists in users table at creation time.
  4. Retry the folder creation once connectivity is restored.
Defensive patterns

Strategy: retry

Validate before calling

if (!$usersTable->exists(['id' => $uac->getId()])) { throw new InvalidArgumentException('User does not exist'); }

Try / catch

try { $service->create($uac, $data); } catch (InternalErrorException $e) { log_error($e->getPrevious()); /* check DB, retry */ }

Prevention

When it happens

Trigger: PermissionsCreateService::create() throwing any Exception while inserting the OWNER permission — database failure, permission table validation not caught, or constraint violation on the aro/aco foreign keys.

Common situations: Database outages or lock timeouts during folder creation; orphaned permission data causing FK failures; misconfigured permissions table after partial migrations.

Related errors


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

Appendix: source

Thrown at plugins/PassboltCe/Folders/src/Service/Folders/FoldersCreateService.php:187

     *
     * @param \App\Utility\UserAccessControl $uac The current user
     * @param \Passbolt\Folders\Model\Entity\Folder $folder The folder
     * @return void
     */
    private function createPermission(UserAccessControl $uac, Folder $folder): void
    {
        $userId = $uac->getId();
        $permissionData = [
            'aco' => PermissionsTable::FOLDER_ACO,
            'aco_foreign_key' => $folder->id,
            'aro' => PermissionsTable::USER_ARO,
            'aro_foreign_key' => $userId,
            'type' => Permission::OWNER,
        ];
        try {
            $this->permissionsCreateService->create($uac, $permissionData);
        } catch (Exception $error) {
            throw new InternalErrorException('Could not create the folder, please try again later.', 500, $error);
        }
    }

    /**
     * Create the folder relation.
     *
     * @param \App\Utility\UserAccessControl $uac The current user
     * @param \Passbolt\Folders\Model\Entity\Folder $folder The folder
     * @param \Passbolt\Metadata\Model\Dto\MetadataFolderDto $folderDto Folder DTO.
     * $data.folder_parent_id $string The folder parent id
     * @return void
     */
    private function createFolderRelation(UserAccessControl $uac, Folder $folder, MetadataFolderDto $folderDto): void
    {
        $data = $folderDto->toArray();
        $folderParentId = Hash::get($data, 'folder_parent_id', null);
        if (!is_null($folderParentId)) {
            $this->validateParentFolder($uac, $folder, $folderParentId);

View on GitHub (pinned to 31c1bbc10f)