Significant-Gravitas/AutoGPT · warning · Error

Failed to reset usage

Error message

Failed to reset usage

What it means

Raised by execute_transfer when either sourceApprovedByUserId or targetApprovedByUserId is null. Execution moves the resource between orgs and requires explicit approval from both sides; a single-sided approval leaves the transfer in SOURCE_APPROVED/TARGET_APPROVED state, not executable.

Source

Thrown at autogpt_platform/frontend/src/app/(platform)/admin/rate-limits/components/useRateLimitManager.ts:160

    }
  }

  async function handleSelectUser(user: UserOption) {
    setSelectedUser(user);
    setRateLimitData(null);
    await fetchRateLimit(user.user_id);
  }

  async function handleReset(resetWeekly: boolean) {
    if (!rateLimitData) return;

    try {
      const response = await postV2ResetUserRateLimitUsage({
        user_id: rateLimitData.user_id,
        reset_weekly: resetWeekly,
      });
      if (response.status !== 200) {
        throw new Error("Failed to reset usage");
      }
      setRateLimitData(response.data);
      toast({
        title: "Success",
        description: resetWeekly
          ? "Daily and weekly usage reset to zero."
          : "Daily usage reset to zero.",
      });
    } catch (error) {
      console.error("Error resetting rate limit:", error);
      toast({
        title: "Error",
        description: "Failed to reset rate limit usage.",
        variant: "destructive",
      });
    }
  }

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Gate the execute action on both sourceApprovedByUserId and targetApprovedByUserId being set (equivalently, on status being fully approved).
  2. Poll or subscribe to the transfer and only enable execute when both approvals exist.
  3. Read the status field: only attempt execute once the transfer leaves the single-sided approved states.

Example fix

# before
await execute_transfer(tid, user_id, org_id)

# after
tr = await get_transfer(tid)
if not (tr.source_approved_by_user_id and tr.target_approved_by_user_id):
    raise RuntimeError("Waiting for the second org's approval")
await execute_transfer(tid, user_id, org_id)
Defensive patterns

Strategy: validation

Validate before calling

tr = await get_transfer(transfer_id)
if not (tr.source_approved_by_user_id and tr.target_approved_by_user_id):
    wait_for_second_approval()  # do not execute yet

Type guard

def fully_approved(tr: TransferResponse) -> bool:
    return tr.source_approved_by_user_id is not None and tr.target_approved_by_user_id is not None

Try / catch

try:
    await execute_transfer(tid, user_id, org_id)
except ValueError as e:
    if "approval from both" in str(e):
        notify_missing_side(tr)
    else:
        raise

Prevention

When it happens

Trigger: Calling execute after only one org approved (status is still SOURCE_APPROVED or TARGET_APPROVED). E.g. the source org approves and immediately tries to execute before the target org has acted.

Common situations: Misunderstanding that one approval suffices; UI showing an execute button as soon as the current user approved; automation firing execute on status change without checking both approval fields.

Related errors


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