Skip to content

fix(proxy): report a failed DAP request's body.error.format instead of a bare "Request failed" (#663) - #666

Merged
debugmcpdev merged 3 commits into
mainfrom
fix/663-dap-error-format
Sep 2, 2026
Merged

fix(proxy): report a failed DAP request's body.error.format instead of a bare "Request failed" (#663)#666
debugmcpdev merged 3 commits into
mainfrom
fix/663-dap-error-format

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Summary

Closes #663. Found while dogfooding #658 with mcp-debugger attached to a live mcp-debugger server.

evaluate_expression on an identifier not visible from the paused frame returned {"success":false,"error":"Request failed"} while the proxy log's telemetry line carried the real text, Uncaught ReferenceError: httpSessions is not defined.

Why

js-debug sends its user-facing errors as a ProtocolError:

this._send({ ...response, success: false, body: { error: cause } })   // no top-level `message`

MinimalDapClient rejected a failed response with new Error(response.message || 'Request failed'), so every js-debug user error (ReferenceError/SyntaxError in evaluate, a bad frame id, setVariable on a read-only binding, …) reached the agent as the generic fallback. Per the DAP spec, ErrorResponse.message is the raw short form a client may leave unset; body.error is the user-facing Message (format with {name} placeholders filled from variables).

Fix

Tests

  • tests/unit/proxy/dap-response-error.test.ts: precedence, js-debug shape, empty/malformed fallbacks, placeholder substitution.
  • minimal-dap.test.ts: rejection with body.error.format only, placeholder filling, and the log line's errorMessage.
  • dap-mirror-server.test.ts: a forwarded failure with only body.error reaches the mirror client as message.

Full pre-push suite green (4935 tests); ratchet unchanged; fragment changelog.d/663.fixed.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DP1W22KJbkHZi4ueAtMFPF

CI Bot and others added 3 commits September 2, 2026 17:01
…f a bare "Request failed" (#663)

js-debug sends its user-facing errors as a ProtocolError —
{success:false, body:{error:{id, format, …}}} with no top-level message —
and MinimalDapClient rejected a failed response with
new Error(response.message || 'Request failed'). So a ReferenceError in
evaluate_expression, a bad frame id, or any other js-debug user error
reached the agent as "Request failed", with the real text visible only
in the adapter's telemetry line in the proxy log.

Per the DAP spec, ErrorResponse.message is the raw short form a client
may leave unset and body.error is the user-facing Message ({name}
placeholders filled from variables). dapResponseErrorMessage /
dapResponseErrorText (src/proxy/dap-response-error.ts) read message,
then the formatted body.error, then the generic fallback; the client's
rejection, its response log line (issue #519's errorMessage field), and
the expose_session mirror's forwarded error all use it. Child sessions
share MinimalDapClient, so js-debug's adopted target is covered too.

Closes #663

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DP1W22KJbkHZi4ueAtMFPF
@debugmcpdev
debugmcpdev merged commit 8632ede into main Sep 2, 2026
8 checks passed
@debugmcpdev
debugmcpdev deleted the fix/663-dap-error-format branch September 2, 2026 17:18
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A failed DAP response without a top-level message (js-debug ProtocolError) reaches the agent as a bare "Request failed"

1 participant