Skip to content

MCP: wait_for_run_to_complete blocks indefinitely when run is stuck in Dequeued #3032

@JuanOrtega10

Description

@JuanOrtega10

Bug

The wait_for_run_to_complete MCP tool blocks indefinitely if a run never transitions to a terminal state (e.g., stuck in DEQUEUED because the dev worker isn't processing it).

This causes MCP clients (like Claude Code) to hang forever waiting for a response — in my case 19+ minutes before I manually interrupted.

Steps to reproduce

  1. Trigger a task via the MCP trigger_task tool (dev environment)
  2. Call wait_for_run_to_complete with the returned runId
  3. If the dev worker is restarting, disconnected, or otherwise not picking up the run, it stays in DEQUEUED state
  4. The MCP tool never returns — it blocks indefinitely

Expected behavior

wait_for_run_to_complete should:

  • Accept an optional timeout parameter (e.g., default 120s)
  • Return an error or status update if the timeout is exceeded (e.g., { status: "DEQUEUED", error: "timeout_exceeded" })

Current behavior

The tool blocks forever with no way to set a timeout. The MCP client (Claude Code in my case) shows "Running..." indefinitely.

Environment

  • Trigger.dev v4 (dev mode)
  • MCP server: @anthropic-ai/claude-code using Trigger.dev MCP
  • Worker: local dev worker (npx trigger.dev dev)

Workaround

Avoid wait_for_run_to_complete entirely. Instead use a polling pattern:

  1. trigger_task → get runId
  2. sleep 5s
  3. get_run_details(runId) → check status
  4. Repeat or report stuck if still DEQUEUED after ~15s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions