bytedance/deer-flow · error · HTTPException
Thread has a run in flight. Clear the goal after the run fin
Error message
Thread has a run in flight. Clear the goal after the run finishes.
What it means
Error "Thread has a run in flight. Clear the goal after the run finishes." thrown in bytedance/deer-flow.
Source
Thrown at backend/app/gateway/routers/threads.py:1123
raise HTTPException(status_code=409, detail="Thread has a run in flight. Set the goal after the run finishes.") from None
except HTTPException:
raise
except Exception:
logger.exception("Failed to set goal for thread %s", sanitize_log_param(thread_id))
raise HTTPException(status_code=500, detail="Failed to set thread goal") from None
return ThreadGoalResponse(goal=goal)
@router.delete("/{thread_id}/goal", response_model=ThreadGoalResponse)
@require_permission("threads", "write", owner_check=True)
async def clear_thread_goal(thread_id: ThreadId, request: Request) -> ThreadGoalResponse:
"""Clear the active goal for a thread."""
checkpointer = get_checkpointer(request)
try:
async with reserve_checkpoint_write(request, thread_id, user_id=get_effective_user_id()):
await write_thread_goal(checkpointer, thread_id, None, as_node="goal")
except ConflictError:
raise HTTPException(status_code=409, detail="Thread has a run in flight. Clear the goal after the run finishes.") from None
except LookupError:
return ThreadGoalResponse(goal=None)
except Exception:
logger.exception("Failed to clear goal for thread %s", sanitize_log_param(thread_id))
raise HTTPException(status_code=500, detail="Failed to clear thread goal") from None
return ThreadGoalResponse(goal=None)
def _thread_compact_response(result: ThreadCompactionResult) -> ThreadCompactResponse:
return ThreadCompactResponse(
thread_id=result.thread_id,
compacted=result.compacted,
reason=result.reason,
removed_message_count=result.removed_message_count,
preserved_message_count=result.preserved_message_count,
summary_updated=result.summary_updated,
checkpoint_id=result.checkpoint_id,
total_tokens=result.total_tokens,View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Wait for the in-flight run to finish, then clear the goal.
- Cancel the active run first if you need to clear the goal immediately.
When it happens
Trigger: Thrown at backend/app/gateway/routers/threads.py:1123 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/4b6869df8836c93c.
Report an issue: GitHub.