Skip to content

sqlalchemy.exc.InvalidRequestError: A transaction is already begun on this Session. #2654

@d213honeynet

Description

@d213honeynet

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I did read the README!
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)
  • I have read and checked all configs (with all optional parts)

Expected Behavior

the malware analysis process successful, not failed_processing

Current Behavior

failed_processing because an error, with the error message : "sqlalchemy.exc.InvalidRequestError: A transaction is already begun on this Session."

Steps to Reproduce

  1. Install and setup the kvm-qemu.sh and cape2.sh
  2. Config the .conf file
  3. Restart all .services
  4. Submit the malware
  5. Waiting the analysis process
  6. Analysis process give the failed_processing result

Context

Question Answer
OS Host Ubuntu 24.04.2 LTS Desktop
OS Victim Windows 10 Pro 22H2

Failure Logs

27 19:02:29 cape poetry[28644]: INFO: modules.reporting.resubmitexe: Resubmitexe file "/opt/CAPEv2/storage/analyses/2/files/c8614f11c662ba838ef6ed98e378576c7af342d71f38ec24d9aa4fc6b28352a9_link/GRVoMsBieCs.doc" added as task with ID [3] resub count 0
Jul 27 19:02:29 cape poetry[28644]: INFO: modules.reporting.resubmitexe: Resubmitexe file "/opt/CAPEv2/storage/analyses/2/files/c8614f11c662ba838ef6ed98e378576c7af342d71f38ec24d9aa4fc6b28352a9_link/GRVoMsBieCs.doc" added as task with ID {} resub count 1
Jul 27 19:02:29 cape poetry[28644]: INFO: modules.reporting.resubmitexe: Resubmitexe file "/opt/CAPEv2/storage/analyses/2/files/9ef4492d81a6e6aece1d916863a07f92145fe95856be0293be9bb813b135ce33_link/GEXgVcgJPI.doc" added as task with ID [4] resub count 2
Jul 27 19:02:29 cape poetry[28644]: INFO: modules.reporting.resubmitexe: Resubmitexe file "/opt/CAPEv2/storage/analyses/2/files/9ef4492d81a6e6aece1d916863a07f92145fe95856be0293be9bb813b135ce33_link/GEXgVcgJPI.doc" added as task with ID {} resub count 3
Jul 27 19:02:29 cape poetry[28644]: INFO: modules.reporting.resubmitexe: Hit resub limit of 3, stopping iteration
Jul 27 19:02:29 cape poetry[28644]: DEBUG: lib.cuckoo.core.plugins: Executing reporting module "JsonDump"
Jul 27 19:02:31 cape poetry[28644]: DEBUG: lib.cuckoo.core.plugins: Executing reporting module "TMPFSCLEAN"
Jul 27 19:02:31 cape poetry[28644]: DEBUG: modules.reporting.tmpfsclean: Deleting memdump: /mnt/tmpfs/2.dmp
Jul 27 19:02:31 cape poetry[28644]: DEBUG: lib.cuckoo.core.plugins: Executing reporting module "MongoDB"
Jul 27 19:02:32 cape poetry[28644]: INFO: dev_utils.mongodb: attempting to delete calls for 1 tasks
Jul 27 19:02:32 cape poetry[28644]: DEBUG: modules.reporting.mongodb: Deleted previous MongoDB data for Task 2
Jul 27 19:02:34 cape poetry[2679]: 2025-07-27 19:02:34,736 [root] ERROR: [2] Exception when processing task: A transaction is already begun on this Session.
Jul 27 19:02:34 cape poetry[2679]: pebble.common.types.RemoteTraceback: Traceback (most recent call last):
Jul 27 19:02:34 cape poetry[2679]: File "/home/cape/.cache/pypoetry/virtualenvs/capev2-t2x27zRb-py3.12/lib/python3.12/site-packages/pebble/common/process.py", line 65, in process_execute
Jul 27 19:02:34 cape poetry[2679]: return Result(ResultStatus.SUCCESS, function(*args, **kwargs))
Jul 27 19:02:34 cape poetry[2679]: ^^^^^^^^^^^^^^^^^^^^^^^^^
Jul 27 19:02:34 cape poetry[2679]: File "/opt/CAPEv2/utils/process.py", line 160, in process
Jul 27 19:02:34 cape poetry[2679]: with db.session.begin():
Jul 27 19:02:34 cape poetry[2679]: ^^^^^^^^^^^^^^^^^^
Jul 27 19:02:34 cape poetry[2679]: File "", line 2, in begin
Jul 27 19:02:34 cape poetry[2679]: File "", line 2, in begin
Jul 27 19:02:34 cape poetry[2679]: File "/home/cape/.cache/pypoetry/virtualenvs/capev2-t2x27zRb-py3.12/lib/python3.12/site-packages/sqlalchemy/util/deprecations.py", line 375, in warned
Jul 27 19:02:34 cape poetry[2679]: return fn(*args, **kwargs)
Jul 27 19:02:34 cape poetry[2679]: ^^^^^^^^^^^^^^^^^^^
Jul 27 19:02:34 cape poetry[2679]: File "/home/cape/.cache/pypoetry/virtualenvs/capev2-t2x27zRb-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1334, in begin
Jul 27 19:02:34 cape poetry[2679]: raise sa_exc.InvalidRequestError(
Jul 27 19:02:34 cape poetry[2679]: sqlalchemy.exc.InvalidRequestError: A transaction is already begun on this Session.
Jul 27 19:02:34 cape poetry[2679]: The above exception was the direct cause of the following exception:
Jul 27 19:02:34 cape poetry[2679]: Traceback (most recent call last):
Jul 27 19:02:34 cape poetry[2679]: File "/opt/CAPEv2/utils/process.py", line 355, in processing_finished
Jul 27 19:02:34 cape poetry[2679]: _ = future.result()
Jul 27 19:02:34 cape poetry[2679]: ^^^^^^^^^^^^^^^
Jul 27 19:02:34 cape poetry[2679]: File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
Jul 27 19:02:34 cape poetry[2679]: return self.__get_result()
Jul 27 19:02:34 cape poetry[2679]: ^^^^^^^^^^^^^^^^^^^
Jul 27 19:02:34 cape poetry[2679]: File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
Jul 27 19:02:34 cape poetry[2679]: raise self._exception
Jul 27 19:02:34 cape poetry[2679]: sqlalchemy.exc.InvalidRequestError: A transaction is already begun on this Session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions