{"record":{"id":"3bffbd2b42e3f696","repo":"passbolt/passbolt_api","slug":"could-not-create-the-folder-please-try-again-later","errorCode":null,"errorMessage":"Could not create the folder, please try again later.","messagePattern":"Could not create the folder, please try again later\\.","errorType":"http","errorClass":"Cake\\Http\\Exception\\InternalErrorException","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltCe/Folders/src/Service/Folders/FoldersCreateService.php","lineNumber":187,"sourceCode":"     *\n     * @param \\App\\Utility\\UserAccessControl $uac The current user\n     * @param \\Passbolt\\Folders\\Model\\Entity\\Folder $folder The folder\n     * @return void\n     */\n    private function createPermission(UserAccessControl $uac, Folder $folder): void\n    {\n        $userId = $uac->getId();\n        $permissionData = [\n            'aco' => PermissionsTable::FOLDER_ACO,\n            'aco_foreign_key' => $folder->id,\n            'aro' => PermissionsTable::USER_ARO,\n            'aro_foreign_key' => $userId,\n            'type' => Permission::OWNER,\n        ];\n        try {\n            $this->permissionsCreateService->create($uac, $permissionData);\n        } catch (Exception $error) {\n            throw new InternalErrorException('Could not create the folder, please try again later.', 500, $error);\n        }\n    }\n\n    /**\n     * Create the folder relation.\n     *\n     * @param \\App\\Utility\\UserAccessControl $uac The current user\n     * @param \\Passbolt\\Folders\\Model\\Entity\\Folder $folder The folder\n     * @param \\Passbolt\\Metadata\\Model\\Dto\\MetadataFolderDto $folderDto Folder DTO.\n     * $data.folder_parent_id $string The folder parent id\n     * @return void\n     */\n    private function createFolderRelation(UserAccessControl $uac, Folder $folder, MetadataFolderDto $folderDto): void\n    {\n        $data = $folderDto->toArray();\n        $folderParentId = Hash::get($data, 'folder_parent_id', null);\n        if (!is_null($folderParentId)) {\n            $this->validateParentFolder($uac, $folder, $folderParentId);","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Folders/src/Service/Folders/FoldersCreateService.php#L169-L205","documentation":"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.","triggerScenarios":"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.","commonSituations":"Database outages or lock timeouts during folder creation; orphaned permission data causing FK failures; misconfigured permissions table after partial migrations.","solutions":["Check the wrapped exception ($error) and server logs for the root database/validation cause.","Verify the permissions table schema/migrations are current (ddev refresh / run migrations).","Confirm the user (aro_foreign_key) exists in users table at creation time.","Retry the folder creation once connectivity is restored."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!$usersTable->exists(['id' => $uac->getId()])) { throw new InvalidArgumentException('User does not exist'); }","typeGuard":null,"tryCatchPattern":"try { $service->create($uac, $data); } catch (InternalErrorException $e) { log_error($e->getPrevious()); /* check DB, retry */ }","preventionTips":["Keep database migrations current","Monitor DB connectivity and lock contention","Never create folders for deleted/nonexistent users"],"tags":["database","permissions","internal-error"],"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"}