bytedance/deer-flow · error · HTTPException

Failed to get thread state

Error message

Failed to get thread state

What it means

Error "Failed to get thread state" thrown in bytedance/deer-flow.

Source

Thrown at backend/app/gateway/routers/threads.py:1208

# ---------------------------------------------------------------------------
@router.get("/{thread_id}/state", response_model=ThreadStateResponse)
@require_permission("threads", "read", owner_check=True)
async def get_thread_state(thread_id: ThreadId, request: Request) -> ThreadStateResponse:
    """Get the latest materialized graph state for a thread."""
    # Resolve through the thread's assistant so custom middleware channels
    # appear in the response instead of being dropped by the default schema.
    try:
        accessor, config = await build_thread_checkpoint_state_accessor(request, thread_id=thread_id)
    except _CHECKPOINT_MODE_ERRORS as exc:
        raise _checkpoint_mode_http_error(exc, thread_id) from exc
    try:
        snapshot = await accessor.aget(config)
    except _CHECKPOINT_MODE_ERRORS as exc:
        raise _checkpoint_mode_http_error(exc, thread_id) from exc
    except Exception:
        logger.exception("Failed to get state for thread %s", sanitize_log_param(thread_id))
        raise HTTPException(status_code=500, detail="Failed to get thread state")

    snapshot_config = snapshot.config or {}
    checkpoint_id = snapshot_config.get("configurable", {}).get("checkpoint_id")
    if not checkpoint_id:
        raise HTTPException(status_code=404, detail=f"Thread {thread_id} not found")

    parent_config = snapshot.parent_config or {}
    parent_checkpoint_id = parent_config.get("configurable", {}).get("checkpoint_id")
    metadata = snapshot.metadata or {}
    created_at = snapshot.created_at or metadata.get("created_at", "")
    tasks_raw = snapshot.tasks or ()
    tasks = [{"id": getattr(task, "id", ""), "name": getattr(task, "name", "")} for task in tasks_raw]

    return ThreadStateResponse(
        values=serialize_channel_values_for_api(snapshot.values),
        next=list(snapshot.next or ()),
        metadata=metadata,
        checkpoint={"id": checkpoint_id, "ts": coerce_iso(created_at)},

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Check the Gateway logs for the underlying state read error.
  2. Verify the thread exists and checkpoint storage is reachable, then retry.

When it happens

Trigger: Thrown at backend/app/gateway/routers/threads.py:1208 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/5482e52b062231a6. Report an issue: GitHub.