dotnet/runtime · error · Error
Failed on mono_wasm_send_dbg_command
Error message
Failed on mono_wasm_send_dbg_command
What it means
Thrown by mono_wasm_send_dbg_command() in debug.ts when the native Mono runtime marks a debugger command response as failed (res_ok=false). This is the simpler variant of the proxy command (no value/valtype parameters); it marshals a base64 command buffer to the heap and reads the reply that native pushed through mono_wasm_add_dbg_command_received. It is invoked by the proxy getters generated in _create_proxy_from_object_id (debug.ts:198) and other debugger read paths.
Source
Thrown at src/mono/browser/runtime/debug.ts:100
mono_wasm_malloc_and_set_debug_buffer(command_parameters);
cwraps.mono_wasm_send_dbg_command_with_parms(id, command_set, command, _debugger_buffer, length, valtype, newvalue.toString());
const { res_ok, res } = commands_received.remove(id);
if (!res_ok)
throw new Error("Failed on mono_wasm_send_dbg_command_with_parms");
return res;
}
export function mono_wasm_send_dbg_command (id: number, command_set: number, command: number, command_parameters: string): CommandResponseResult {
forceThreadMemoryViewRefresh();
mono_wasm_malloc_and_set_debug_buffer(command_parameters);
cwraps.mono_wasm_send_dbg_command(id, command_set, command, _debugger_buffer, command_parameters.length);
const { res_ok, res } = commands_received.remove(id);
if (!res_ok)
throw new Error("Failed on mono_wasm_send_dbg_command");
return res;
}
export function mono_wasm_get_dbg_command_info (): CommandResponseResult {
const { res_ok, res } = commands_received.remove(0);
if (!res_ok)
throw new Error("Failed on mono_wasm_get_dbg_command_info");
return res;
}
export function mono_wasm_debugger_resume (): void {
forceThreadMemoryViewRefresh();
}
export function mono_wasm_detach_debugger (): void {
forceThreadMemoryViewRefresh();View on GitHub (pinned to 290d5ab72c)
Solutions
- Retry the inspection/evaluation once the runtime is no longer loading or paused.
- Reload the page to reset the native command id space and the proxy cache.
- Verify the served runtime .wasm matches the diagnostics/debug JS modules (rebuild and hard-refresh).
- If it persists for a specific object, that object reference is stale; release it and re-acquire from the live runtime.
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try {
return mono_wasm_send_dbg_command(id, command_set, command, command_parameters);
} catch (e) {
console.warn('debugger read failed', { id, command_set, command }, e);
return undefined;
} Prevention
- Do not hold debugger object references across reloads.
- Pause/resume the runtime cleanly before heavy inspection.
- Keep build bundles consistent.
When it happens
Trigger: A proxy property getter firing against a dotnet: object id whose native target is invalid, collected, or belongs to a paused/transitioning runtime. Issuing a debugger read command during module initialization, GC, or thread memory relocation (forceThreadMemoryViewRefresh is called but native can still fail). A stale command id reused after the command buffer was freed.
Common situations: Expanding a .NET object in the DevTools Watch/Scope pane while the runtime is loading or paused at a breakpoint. Evaluating expressions referencing objects from a previous debug session after hot reload. Serving a mismatched runtime wasm + debug JS bundle.
Related errors
- Failed on mono_wasm_send_dbg_command_with_parms
- Unknown object id ${objId}
- Could not find any object with id ${objectId}
- Failed on mono_wasm_get_dbg_command_info
- "arguments" should be an array, but was ${request.arguments}
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/bfd9d5494d942b26.
Report an issue: GitHub.