# Agent Shell Tool Fails on Windows - pid: -1, no command output

**URL:** <https://forum.cursor.com/t/agent-shell-tool-fails-on-windows-pid-1-no-command-output/145331>\
**Category:** Bug Reports\
**Created:** [December 5, 2025, 7:38am UTC](https://forum.cursor.com/t/agent-shell-tool-fails-on-windows-pid-1-no-command-output/145331 "2025-12-05T07:38:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![realbios](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/realbios/32/89627_2.png) [@realbios](https://forum.cursor.com/u/realbios)\
**Post date:** [December 5, 2025, 7:38am UTC](https://forum.cursor.com/t/agent-shell-tool-fails-on-windows-pid-1-no-command-output/145331/1 "2025-12-05T07:38:33Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

## Describe the Bug / バグの説明

```auto
[English]
The AI Agent's Shell tool fails to spawn a proper shell process on Windows. The terminal shows `pid: -1` and all commands return empty output, even though exit code shows 0.

When asking the Agent to run commands like `git status`, `git commit`, or any shell command:
- Exit code returns 0 (appears successful)
- But stdout is always empty
- Terminal file shows `pid: -1` (process not spawned)
- Commands are NOT actually executed

This makes it impossible for the Agent to:
- Execute git operations (commit, push, pull)
- Run build tools or linters
- Execute any shell commands

Evidence from terminal state file:
---
pid: -1
cwd: 
last_command: git status
last_exit_code: 0
---

Note: Regular IDE terminals work fine (pid: 24892, etc.), only Agent-spawned terminals fail.

[日本語]
AIエージェントのシェルツールがWindows環境で正常にシェルプロセスを起動できません。ターミナルには `pid: -1` が表示され、終了コードが0でも全てのコマンド出力が空になります。

`git status`、`git commit` などのコマンドをエージェントに実行させると：
- 終了コードは0（成功に見える）
- しかし標準出力は常に空
- ターミナルファイルには `pid: -1`（プロセス未起動）
- 実際にはコマンドが実行されていない

これにより、エージェントは以下ができません：
- git操作（commit, push, pull）の実行
- ビルドツールやリンターの実行
- あらゆるシェルコマンドの実行

ターミナル状態ファイルの証拠：
---
pid: -1
cwd: 
last_command: git status
last_exit_code: 0
---

注：通常のIDEターミナルは正常動作（pid: 24892など）、エージェントが起動するターミナルのみ失敗します。

```

* * *

### Steps to Reproduce

## Steps to Reproduce / 再現手順

```auto
[English]
1. Open any Git repository workspace on Windows
2. Open Agent chat (Ctrl+L or click Agent)
3. Ask the Agent to run a shell command, e.g.: "Run git status"
4. Observe the result:
   - Exit code: 0
   - Output: empty
   - Check terminals folder: pid: -1

[日本語]
1. Windows環境で任意のGitリポジトリをワークスペースとして開く
2. エージェントチャットを開く（Ctrl+L またはAgentをクリック）
3. エージェントにシェルコマンドの実行を依頼する（例：「git statusを実行して」）
4. 結果を確認：
   - 終了コード：0
   - 出力：空
   - terminalsフォルダを確認：pid: -1

```

* * *

### Expected Behavior

## Expected Behavior / 期待される動作

```auto
[English]
When the Agent executes shell commands:
1. A shell process should spawn with a valid PID
2. Commands should actually execute
3. Command output (stdout/stderr) should be captured and returned
4. Files created by commands (e.g., via redirection) should exist

[日本語]
エージェントがシェルコマンドを実行する際：
1. 有効なPIDを持つシェルプロセスが起動されるべき
2. コマンドが実際に実行されるべき
3. コマンド出力（stdout/stderr）がキャプチャされて返されるべき
4. コマンドで作成されるファイル（リダイレクト等）が存在するべき

```

* * *

### Operating System

Windows 10/11

### Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.48 (system setup)  
VSCode Version: 1.105.1  
Commit: ce371ffbf5e240ca47f4b5f3f20efed084991120  
Date: 2025-12-04T19:26:27.263Z  
Electron: 37.7.0  
Chromium: 138.0.7204.251  
Node.js: 22.20.0  
V8: 13.8.258.32-electron.0  
OS: Windows\_NT x64 10.0.26100

### Additional Information

## Attempted Workarounds / 試した回避策

| # | Workaround / 回避策 | Result / 結果 |
| --- | --- | --- |
| 1 | Reload Window (Developer: Reload Window) / ウィンドウの再読み込み | ❌ No effect / 効果なし |
| 2 | Full Cursor restart / Cursorの完全再起動 | ❌ No effect / 効果なし |
| 3 | Enable Legacy Terminal Tool (`cursor.chat.useLegacyTerminal: true`) | ❌ No effect / 効果なし |
| 4 | Change default terminal to Command Prompt / デフォルトターミナルをCommand Promptに変更 | ❌ No effect / 効果なし |
| 5 | Enable PowerShell Legacy ReadLine / PowerShell Legacy ReadLineの有効化 | ❌ No effect / 効果なし |
| 6 | Use `cmd /c` prefix for commands / コマンドに cmd /c プレフィックスを使用 | ❌ No effect / 効果なし |
| 7 | Use background execution (`is_background: true`) / バックグラウンド実行を使用 | ❌ No effect / 効果なし |
| 8 | Redirect output to file / 出力をファイルにリダイレクト | ❌ File not created / ファイル未作成 |
| 9 | **Change default terminal to Git Bash** / **デフォルトターミナルをGit Bashに変更** | ✅ **SUCCESS! / 成功！** |

* * *

## ✅ Workaround / 回避策

### Current Workaround / 現時点での回避策

**[English]**  
**Set Git Bash as the default terminal profile for Windows:**

1. Open Settings (`Ctrl + ,`)
2. Search for “terminal default profile windows”
3. Select “Git Bash” from the dropdown
4. Restart Cursor

Or add these settings to `settings.json`:

```json
{
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "terminal.integrated.profiles.windows": {
        "Git Bash": {
            "path": "C:\\Program Files\\Git\\bin\\bash.exe",
            "icon": "terminal-bash"
        }
    }
}

```

**Note:** This requires Git for Windows to be installed. After applying this workaround, the Agent can successfully execute shell commands including git operations (commit, push, pull).

* * *

**[日本語]**  
**Git BashをWindowsのデフォルトターミナルプロファイルに設定する：**

1. 設定を開く（`Ctrl + ,`）
2. “terminal default profile windows” を検索
3. ドロップダウンから “Git Bash” を選択
4. Cursorを再起動

または、`settings.json` に以下の設定を追加：

```json
{
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "terminal.integrated.profiles.windows": {
        "Git Bash": {
            "path": "C:\\Program Files\\Git\\bin\\bash.exe",
            "icon": "terminal-bash"
        }
    }
}

```

**注意:** この回避策にはGit for Windowsのインストールが必要です。この回避策を適用後、エージェントはgit操作（commit, push, pull）を含むシェルコマンドを正常に実行できるようになります。

* * *

## Operating System / オペレーティングシステム

```auto
Windows 10/11
(Build 10.0.26100)

```

* * *

## Additional Information / 追加情報

```auto
[English]
Related issues:
- https://github.com/cursor/cursor/issues/2669
- https://forum.cursor.com/t/agent-shell-tool-fails-to-spawn-shell-process-on-wsl-pid-1/145286
- https://forum.cursor.com/t/windows-dotnet-shell-commands-not-working/138807

Settings applied (no effect):
{
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "cursor.chat.useLegacyTerminal": true,
    "powershell.integratedConsole.useLegacyReadLine": true
}

[日本語]
関連するIssue：
- https://github.com/cursor/cursor/issues/2669
- https://forum.cursor.com/t/agent-shell-tool-fails-to-spawn-shell-process-on-wsl-pid-1/145286
- https://forum.cursor.com/t/windows-dotnet-shell-commands-not-working/138807

適用した設定（効果なし）：
{
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "cursor.chat.useLegacyTerminal": true,
    "powershell.integratedConsole.useLegacyReadLine": true
}

```

* * *

### Does this stop you from using Cursor

No - Cursor works, but with this issue

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [December 5, 2025, 10:21am UTC](https://forum.cursor.com/t/agent-shell-tool-fails-on-windows-pid-1-no-command-output/145331/3 "2025-12-05T10:21:39Z")

</div>

Hey, thanks for the detailed report and for the Git Bash workaround - super helpful.

This is a known regression in the new Windows terminal. We’re tracking it here: [Cursor version 2.1.39 has terminal bug](https://forum.cursor.com/t/cursor-version-2-1-39-has-terminal-bug/144368)

To help us fix it faster, please attach:

- Logs from Help → Toggle Developer Tools when the agent tries to run a command
- Output from “Extension Host” and “Shared Process” at the time of the error
- The result of launching Cursor with `--disable-extensions`

I’ll link your case to the existing issue.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [December 27, 2025, 10:23am UTC](https://forum.cursor.com/t/agent-shell-tool-fails-on-windows-pid-1-no-command-output/145331/5 "2025-12-27T10:23:12Z")

</div>

Closed on December 27, 2025, 10:23am UTC

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.
