DebugMCP icon indicating copy to clipboard operation
DebugMCP copied to clipboard

Misleading error messages given to agent

Open mccaullinsjason opened this issue 2 months ago • 1 comments

Misconfigurations in either launch.json or tasks.json lead to misleading messages being sent to agents as their error messages are not being properly propagated through the MCP tool call. Example error message visible to a user in the workspace terminal:

[*] Executing task: Copy Item -Force ...
Copy-Item: A positional parameter cannot be found that accepts argument '${SOMEPATH}'
# may indicate that double quotes have not been escaped properly in a path with spaces

[*] The terminal process "\path\to\pwsh.exe -Command -Copy-Item -Force ..." terminated with exit code: 1

Instead, the agent gets a misleading "Error: Failed to start debug session. Make sure the appropriate language extension is installed". This leads the agent down a wild goose chase following incorrect leads and requires the user to actively intervene. While it's usually a one-time setup problem, better error messages would guide the agent to better diagnose and fix misconfigurations without user hand-holding.

Agent: OpenCode with debug-live skill provided. Host: Windows DebugMCP version: 2.3.3 VSCode version: 1.134.0

mccaullinsjason avatar Sep 04 '26 02:09 mccaullinsjason

Thanks for reporting this! The fix has been merged in #150, and this issue was automatically closed by the merge.

DebugMCP now reports the matching pre-launch task name and nonzero exit code when available, preserves startup errors, and no longer assumes a missing language extension when VS Code declines startup. Task failures are reported even while VS Code is waiting on its task-error dialog.

We reproduced your exact Copy-Item positional-parameter error on Windows with VS Code 1.134.0 through a real MCP request. The agent received the task name and exit code 1 in about 1.5 seconds, before the dialog was dismissed. Both Abort and Debug Anyway behaved correctly. The full test suite also passed (179 tests).

One API limitation remains: VS Code task events do not include terminal output and can omit the exit code. The response therefore points to the task terminal for the original PowerShell error rather than claiming to capture it.

The fix is on main and will be included in the next extension release; merging the PR does not update the currently published extension.

ozzafar avatar Sep 09 '26 11:09 ozzafar