Significant-Gravitas/AutoGPT · error · ValueError

Cannot approve a transfer with status '{tr.status}'

Error message

Cannot approve a transfer with status '{tr.status}'

What it means

Error "Cannot approve a transfer with status '{tr.status}'" thrown in Significant-Gravitas/AutoGPT.

Source

Thrown at autogpt_platform/backend/backend/api/features/transfers/db.py:91


async def approve_transfer(
    transfer_id: str,
    user_id: str,
    org_id: str,
) -> TransferResponse:
    """Approve a transfer from the source or target side.

    - If user's active org is the source org, sets sourceApprovedByUserId.
    - If user's active org is the target org, sets targetApprovedByUserId.
    - Advances the status accordingly.
    """
    tr = await prisma.transferrequest.find_unique(where={"id": transfer_id})
    if tr is None:
        raise NotFoundError(f"Transfer request {transfer_id} not found")

    if tr.status in ("COMPLETED", "REJECTED"):
        raise ValueError(f"Cannot approve a transfer with status '{tr.status}'")

    update_data: dict = {}

    if org_id == tr.sourceOrganizationId:
        if tr.sourceApprovedByUserId is not None:
            raise ValueError("Source organization has already approved this transfer")
        update_data["sourceApprovedByUserId"] = user_id
        if tr.targetApprovedByUserId is not None:
            # Both sides approved — ready for execution (NOT completed yet)
            update_data["status"] = "TARGET_APPROVED"
        else:
            update_data["status"] = "SOURCE_APPROVED"

    elif org_id == tr.targetOrganizationId:
        if tr.targetApprovedByUserId is not None:
            raise ValueError("Target organization has already approved this transfer")
        update_data["targetApprovedByUserId"] = user_id
        if tr.sourceApprovedByUserId is not None:

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Check the transfer status; only pending transfers can be approved.
  2. Refresh the transfer details before approving.

When it happens

Trigger: Thrown at autogpt_platform/backend/backend/api/features/transfers/db.py:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/ce1d265581d25675. Report an issue: GitHub.