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() in debug.ts. Unlike the send functions, this reads the command id 0 entry from the commands_received map (the special handshake/info slot populated by native). A res_ok=false here means the native debugger agent failed to produce the initial command info, i.e. the debugger protocol handshake or the very first info query failed.

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 290d5ab72c)

Solutions

  1. Wait until the runtime/debugger agent signals ready before issuing info queries (mono_wasm_runtime_ready / waitForDebugger flow).
  2. Build the app with debugger support enabled (debug configuration, not a release build that strips the debugger).
  3. Reload so the native agent re-initializes cleanly.
  4. Confirm DOTNET_SYSTEM_NET_* and debugger-related build properties are not disabling the diagnostic/debug agent.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

let info;
try { info = mono_wasm_get_dbg_command_info(); }
catch (e) { /* debugger agent not ready/errored; wait and retry or report */ throw e; }

Prevention

When it happens

Trigger: Calling mono_wasm_get_dbg_command_info() before the native debugger agent has pushed the id=0 response, or when the native agent errored during its initial command. Racing the info query with runtime teardown or before the debugger module finished initializing.

Common situations: Attaching DevTools/VS Code debugger before the WASM runtime debugger agent is fully ready. Debugging a build where the debugger native code was stripped or a debugger-related env var disabled the agent. A runtime build that did not include debugger support.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/2bc853c7d792e3e5. Report an issue: GitHub.