Significant-Gravitas/AutoGPT · warning · HTTPException

start and end query params are required

Error message

start and end query params are required

What it means

HTTP 400 from the admin credit-transaction export endpoint. Both `start` and `end` Optional datetime query params must be present; omitting either triggers this guard before the export query runs. This is deliberate fail-fast so exports never run over an unbounded range.

Source

Thrown at autogpt_platform/backend/backend/api/features/admin/credit_admin_routes.py:131

    transaction_type: typing.Optional[CreditTransactionType] = Query(None),
    user_id: typing.Optional[str] = Query(None),
    include_inactive: bool = Query(
        False,
        description=(
            "Include inactive rows (e.g. abandoned Stripe checkouts). "
            "Off by default so phantom rows aren't surfaced in normal exports."
        ),
    ),
    admin_user_id: str = Security(get_user_id),
) -> CreditTransactionsExportResponse:
    """Export CreditTransaction rows in [start, end].

    Capped at CREDIT_EXPORT_MAX_DAYS days and CREDIT_EXPORT_MAX_ROWS rows;
    over-cap requests fail fast with 400 so callers narrow the window
    instead of receiving silently truncated data.
    """
    if start is None or end is None:
        raise HTTPException(
            status_code=400, detail="start and end query params are required"
        )
    # Coerce naive datetimes to UTC at the boundary so neither the data layer
    # nor the response builder hits a TypeError on (end - start) when callers
    # send mixed naive/aware shapes.
    if start.tzinfo is None:
        start = start.replace(tzinfo=timezone.utc)
    if end.tzinfo is None:
        end = end.replace(tzinfo=timezone.utc)
    logger.info(
        "Admin %s exporting credit transactions [%s..%s] type=%s user=%s incl_inactive=%s",
        admin_user_id,
        start.isoformat(),
        end.isoformat(),
        transaction_type.value if transaction_type else None,
        user_id,
        include_inactive,
    )

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Send both bounds as ISO timestamps: ?start=...&end=...
  2. Disable the export button until both dates are chosen.
  3. Apply a sensible default window client-side (e.g. last 30 days) when the picker is untouched.

Example fix

// before
exportCsv(`/admin/credits/export?type=${type}`)

// after
exportCsv(`/admin/credits/export?start=${startIso}&end=${endIso}&type=${type}`)
Defensive patterns

Strategy: validation

Validate before calling

if (!start || !end) throw new Error('Both start and end are required');
const qs = new URLSearchParams({ start, end, ...filters });

Prevention

When it happens

Trigger: GET /admin/credits/export (no query), or only one of ?start=/?end= present.

Common situations: CSV export button firing before the admin selects a range; frontend dropping an empty date input from the query string; copy-pasted curl missing one bound.

Related errors


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