bytedance/deer-flow · error · HTTPException
after_seq is not supported by this backward-only endpoint
Error message
after_seq is not supported by this backward-only endpoint
What it means
Error "after_seq is not supported by this backward-only endpoint" thrown in bytedance/deer-flow.
Source
Thrown at backend/app/gateway/routers/thread_runs.py:1353
# multi-step turn (#4152). The legacy ``GET /messages`` and ``/history``
# endpoints already use ``stamp_turn_duration_on_last_ai``; the page
# endpoint was inlining the equivalent loop but stamping every AI row,
# which #4163 fixed for the other paths and missed here.
stamp_turn_duration_on_last_ai(data, run_durations)
return data
@router.get("/{thread_id}/messages/page", response_model=ThreadMessagesPageResponse)
@require_permission("runs", "read", owner_check=True)
async def list_thread_messages_page(
thread_id: ThreadId,
request: Request,
limit: int = Query(default=50, ge=1, le=200),
before_seq: int | None = Query(default=None, ge=1),
) -> ThreadMessagesPageResponse:
"""Return a backward page ordered by the thread-global event sequence."""
if "after_seq" in request.query_params:
raise HTTPException(status_code=422, detail="after_seq is not supported by this backward-only endpoint")
user_id = await get_current_user(request)
rows, has_more = await _scan_thread_message_page(
thread_id,
limit=limit,
before_seq=before_seq,
request=request,
user_id=user_id,
)
data = await _enrich_thread_message_page(thread_id, rows, request=request, user_id=user_id)
return ThreadMessagesPageResponse(
data=data,
has_more=has_more,
next_before_seq=data[0]["seq"] if has_more else None,
)
@router.get("/{thread_id}/runs/{run_id}/messages")View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Use before_seq for paging backwards; this endpoint only supports backward pagination.
- Remove after_seq from the request.
When it happens
Trigger: Thrown at backend/app/gateway/routers/thread_runs.py:1353 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/d2d192cac94f0609.
Report an issue: GitHub.