Cursor Agent Mode Tool Call Stuck Pending

Agent mode shows a spinner forever on a tool call — usually a hung shell command, network block, or a permission prompt you never accepted.

Cursor’s agent runs a tool call and the UI shows a spinner that never resolves. The “Stop” button does nothing, the chat is frozen, and even sending a new message just queues behind the dead call. Underneath the spinner is one of three things: a shell command that is waiting for input you cannot see, a network request blocked by your firewall or VPN, or a permission prompt that scrolled off screen before you noticed it.

None of these are fixed by waiting longer. This article walks the diagnosis and the cleanest way to break the deadlock without losing chat history.

Common causes

1. Shell command is waiting for interactive input

The agent ran git rebase -i or npm init or gh auth login — commands that pop a prompt. Agent mode has no TTY for interactive input, so the process hangs forever.

How to judge: open a real terminal and ps aux | grep <command> — if the command is sitting there with state S+ and the parent is Cursor, that is the hang.

2. Tool call is blocked by network

The agent called WebSearch or fetch to a domain your VPN, firewall, or corporate proxy blocks. The request never completes, never errors — just sits.

How to judge: check Cursor’s developer tools (Help > Toggle Developer Tools) > Network tab. Pending request stuck on a domain you cannot reach.

3. Permission prompt was dismissed or missed

Agent mode asks before running shell commands. If you scrolled past or accidentally clicked outside the dialog, the agent waits for a decision it never gets.

How to judge: scroll the chat all the way down — is there a faded “Approve / Reject” button you forgot to click?

4. Long-running command (build / install) that legitimately takes minutes

npm install on a fresh node_modules can take 3-5 minutes. cargo build --release on a big crate can take 10+. The agent UI shows “running” with no progress bar.

How to judge: open a real terminal and run the same command — if it also takes 5 minutes, the agent is not stuck, just slow.

5. Cursor process is genuinely hung

A bug in agent mode, a memory leak, or the Electron renderer locked up. Stop button does not respond and CPU usage stays flat at 0% (a live process would show some activity).

How to judge: Activity Monitor / Task Manager — Cursor’s helper process at 0% CPU and not consuming I/O is a likely hang.

6. Tool call timed out but UI did not update

The backend timed out the call after 60 or 120 seconds but the frontend never received the close event. UI still shows pending even though the call already failed server-side.

How to judge: Help > Toggle Developer Tools > Console — look for “timeout” or “abort” errors that did not propagate to the UI.

Before you start

  • Note which tool call is stuck (terminal, file edit, web search, MCP) — the fix differs.
  • Do not click Stop repeatedly; if it is going to work it works on the first click.
  • Capture the chat URL / ID so you can resume after fixing.

Information to collect

  • The exact tool call name and parameters shown in the chat.
  • Approximate time the spinner has been spinning.
  • Cursor version (Cursor > About).
  • Any VPN / proxy / firewall in use.
  • Output of ps aux | grep -i cursor on macOS / Linux, or Task Manager on Windows.
  • Help > Toggle Developer Tools > Console errors.

Step-by-step fix

Step 1: Identify what kind of tool call is stuck

In the chat, expand the pending tool call. Common types:

  • run_terminal_cmd — shell command in Cursor’s integrated terminal.
  • web_search / fetch_url — network request.
  • edit_file / read_file — file system operation.
  • mcp_<name> — Model Context Protocol tool.

The hang pattern is different for each.

Step 2: For stuck terminal commands, kill the underlying process

On macOS / Linux:

ps aux | grep -E "node|npm|cargo|git" | grep -v grep
kill -TERM <pid>
# If TERM does not work in 5 seconds:
kill -KILL <pid>

On Windows:

Get-Process | Where-Object {$_.ProcessName -match "node|npm|cargo"} | Stop-Process

Once the underlying process dies, Cursor usually receives the close event within 30 seconds and the spinner clears.

Step 3: For stuck network calls, check connectivity and bypass

Open a real terminal:

curl -v https://api.cursor.sh/ 2>&1 | head -20
curl -v https://api.openai.com/ 2>&1 | head -20

If either hangs or fails:

  1. Disable VPN temporarily and retest.
  2. Check corporate proxy: echo $HTTP_PROXY $HTTPS_PROXY.
  3. Add Cursor’s domains to your firewall allowlist: *.cursor.sh, api.anthropic.com, api.openai.com.

Step 4: Reload the window without losing chat

Cursor menu > Developer > Reload Window (Cmd/Ctrl+R). This restarts the renderer process but keeps your chat history on disk. The pending tool call clears and you can retry.

If Reload Window also hangs:

  1. Force-quit Cursor entirely.
  2. Reopen Cursor.
  3. Open the same project; the chat sidebar should show your previous conversation.

Step 5: Disable problematic MCP servers

If the hang is on an mcp_<name> tool, the MCP server itself may be broken:

# Find the MCP config
cat ~/.cursor/mcp.json

Comment out the suspect server, restart Cursor, retry. Common culprits are MCP servers that try to spawn a subprocess on every call without timeout.

Step 6: Run hangs in the background instead of letting agent block

For commands you know will take minutes (npm install, cargo build), tell the agent to use background mode in the prompt:

Run `npm install` in the background and check back in 60 seconds.
Do not block on the install output.

Agent mode supports run_in_background: true on terminal calls and will not wait for the command to complete before continuing.

Verify

  • Open a fresh chat, retry the same prompt — should complete normally.
  • Run a known-fast tool call (ls, simple file read) to confirm tool calls in general are working.
  • Check Help > Toggle Developer Tools > Console for clean output, no pending promises.
  • If the hang involved a specific MCP server, run a manual test of that server with mcp-debug or equivalent.

Long-term prevention

  • Never ask the agent to run interactive commands (git rebase -i, vim, nano, npm init without -y); use non-interactive equivalents.
  • Configure long-running commands to use run_in_background: true from the start.
  • Keep an eye on the Approve / Reject panel after every prompt — agent mode pauses silently if you do not respond.
  • Add a 5-minute timeout to your own MCP servers; default infinite timeout is the most common hang cause.
  • Update Cursor monthly; agent mode timeout / cancel bugs are actively being fixed.

Common pitfalls

  • Closing the chat tab while a tool call is pending — the underlying process keeps running and can lock the next chat.
  • Force-quitting Cursor without killing child processes first; orphaned node / npm processes can hold ports and confuse the next session.
  • Running multiple agent mode chats in parallel; tool call queues can deadlock if both touch the same file.
  • Approving a prompt then walking away — the agent might still be waiting on a follow-up confirmation.
  • Hidden VPN auto-reconnect after a network change; the agent’s HTTP keep-alive can stay bound to a dead route.

FAQ

Q: Does Cursor have a built-in tool-call timeout? A: Yes for network calls (typically 120s); no global timeout for terminal commands. You must kill them yourself.

Q: Will Reload Window lose my chat? A: No — chats are persisted to disk per project. Reload Window only restarts the renderer.

Q: Can I see what command the agent actually ran? A: Yes — click the tool call header in chat to expand the parameters and stdout.

Q: Why does the Stop button sometimes do nothing? A: Stop signals the model to stop generating, not the underlying tool process. A hung shell command will not respond to Stop; you must kill the process.

Tags: #Cursor #ide #Troubleshooting