dotnet/runtime · error · Error
Failed on mono_wasm_get_dbg_command_info
Error message
Failed on mono_wasm_get_dbg_command_info
What it means
Thrown by `mono_wasm_get_dbg_command_info` when the bootstrap command (keyed under id `0`) returns `res_ok === false`. This call fetches initial debugger bookkeeping from the native runtime; failure means the debugger handshake could not complete.
Solutions
- Only call `mono_wasm_get_dbg_command_info` after `runtimeHelpers.mono_wasm_runtime_is_ready` is true.
- Ensure the runtime was built with the debugger enabled (not a stripped release build).
- Avoid calling it after the debugger has been detached; re-attach first if needed.
- Match the debugger proxy build to the runtime build.
Example fix
// before: queried before runtime ready mono_wasm_get_dbg_command_info(); // throws // after: wait for runtime readiness, then query await runtimeReadyPromise; mono_wasm_get_dbg_command_info();
Defensive patterns
Strategy: validation
Validate before calling
function canQueryCommandInfo () {
return !!runtimeHelpers.mono_wasm_runtime_is_ready;
}
if (canQueryCommandInfo()) mono_wasm_get_dbg_command_info(); Type guard
function isRuntimeReadyForDebugger (): boolean {
return !!runtimeHelpers.mono_wasm_runtime_is_ready;
} Try / catch
try {
return mono_wasm_get_dbg_command_info();
} catch (e) {
if (e instanceof Error && /Failed on mono_wasm_get_dbg_command_info/.test(e.message)) {
// runtime not ready or debugger detached; defer and retry once
setTimeout(() => mono_wasm_get_dbg_command_info(), 100);
return;
}
throw e;
} Prevention
- Wait for `runtimeHelpers.mono_wasm_runtime_is_ready` before querying command info.
- Use a debugger-enabled runtime build for diagnostics workflows.
- Do not call after `mono_wasm_detach_debugger`.
When it happens
Trigger: Calling `mono_wasm_get_dbg_command_info()` (debug.ts:105) before the runtime has fully initialised its debugger, or after the debugger was detached. The native side returns a failing response for id 0 because no command info is available.
Common situations: Invoking the function during startup before `mono_wasm_runtime_ready`; calling it after `mono_wasm_detach_debugger`; runtime build with the debugger stubbed out (release build) that always responds with res_ok=false.
Related errors
- Failed on mono_wasm_send_dbg_command
- Failed on mono_wasm_send_dbg_command_with_parms
- 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/2bc853c7d792e3e5.
Report an issue: GitHub.
Appendix: source
Thrown at src/mono/browser/runtime/debug.ts:109
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();
cwraps.mono_wasm_set_is_debugger_attached(false);
}
export function mono_wasm_change_debugger_log_level (level: number): void {
forceThreadMemoryViewRefresh();
cwraps.mono_wasm_change_debugger_log_level(level);
}
/**View on GitHub (pinned to 60108ba66e)