dotnet/runtime · error · Error
Failed on mono_wasm_send_dbg_command_with_parms
Error message
Failed on mono_wasm_send_dbg_command_with_parms
What it means
Thrown by `mono_wasm_send_dbg_command_with_parms` when the recorded debug-command response has `res_ok === false`. The runtime queued the response via `mono_wasm_add_dbg_command_received`; a false ok flag means the native debugger side rejected the command (bad parameters, unknown command set, or a debugger protocol error). The wrapper turns that into a thrown Error so the debugger proxy surfaces it.
Solutions
- Verify the `command_set` and `command` numbers match the runtime's supported debugger protocol version.
- Check that `command_parameters` is a valid base64 string of the expected length and that `length` matches it.
- Re-issue the command after re-attaching the debugger; an expired session id is the most common cause.
- Match the dotnetDebugger/BrowserDebugProxy build to the runtime build.
Example fix
// before: stale id after the runtime continued mono_wasm_send_dbg_command_with_parms(oldId, set, cmd, b64, len, vt, val); // throws // after: refresh the object id within the same paused state const fresh = mono_wasm_send_dbg_command(curId, set, cmd, b64); mono_wasm_send_dbg_command_with_parms(fresh.id, set, cmd, b64, len, vt, val);
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate parameter shape before sending
function isValidParams (command_parameters, length, valtype, newvalue) {
return typeof command_parameters === 'string' &&
command_parameters.length === length &&
Number.isInteger(valtype) &&
newvalue !== undefined;
} Type guard
function isLiveDebuggerObjectId (objId: unknown): boolean {
return typeof objId === 'number' && Number.isFinite(objId) && objId >= 0;
} Try / catch
try {
return mono_wasm_send_dbg_command_with_parms(id, set, cmd, params, len, vt, val);
} catch (e) {
if (e instanceof Error && /Failed on mono_wasm_send_dbg_command_with_parms/.test(e.message)) {
// refresh ids and retry once within the same paused state
return mono_wasm_send_dbg_command_with_parms(freshId, set, cmd, params, len, vt, val);
}
throw e;
} Prevention
- Keep the debugger paused for the lifetime of any object id you use.
- Match the BrowserDebugProxy build to the runtime build.
- Validate `command_parameters` length and base64 encoding before sending.
When it happens
Trigger: Calling `mono_wasm_send_dbg_command_with_parms(id, command_set, command, command_parameters, length, valtype, newvalue)` (debug.ts:79) where the native runtime records a failing response for `id`. This occurs when the proxy issues a set-value command with an invalid id, wrong value type, malformed base64 `command_parameters`, or an unsupported `command_set`/`command` pair.
Common situations: Stale debugger proxy talking to a runtime with a different debugger protocol version; trying to set a property/getter on an object id whose session has expired; sending parameters with the wrong `valtype` enum value; heap corruption resetting the debug buffer.
Related errors
- Failed on mono_wasm_send_dbg_command
- Failed on mono_wasm_get_dbg_command_info
- args must be an object, but got
- event.eventName is a required parameter, in event
- event must be an object, but got
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/02b7fdafc6d45d79.
Report an issue: GitHub.
Appendix: source
Thrown at src/mono/browser/runtime/debug.ts:87
_debugger_buffer_len = Math.max(command_parameters.length, _debugger_buffer_len, 256);
_debugger_buffer = malloc(_debugger_buffer_len);
}
const byteCharacters = atob(command_parameters);
const heapU8 = localHeapViewU8();
for (let i = 0; i < byteCharacters.length; i++) {
heapU8[<any>_debugger_buffer + i] = byteCharacters.charCodeAt(i);
}
}
export function mono_wasm_send_dbg_command_with_parms (id: number, command_set: number, command: number, command_parameters: string, length: number, valtype: number, newvalue: number): CommandResponseResult {
forceThreadMemoryViewRefresh();
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 {View on GitHub (pinned to 60108ba66e)