can1357/oh-my-pi · error · ToolError

disassemble requires memory_reference unless the current sto

Error message

disassemble requires memory_reference unless the current stop location has an instruction pointer reference

What it means

The disassemble action needs an address to start from: either an explicit `memory_reference` argument, or — when omitted — an instruction-pointer reference from the current stop location. resolveDisassemblyReference found no memory_reference argument and the active session snapshot has no instructionPointerReference, so it cannot determine where to disassemble.

Source

Thrown at packages/coding-agent/src/tools/debug.ts:579

}

function requireCapability(capability: keyof DapCapabilities, description: string): DapSessionSummary {
	const snapshot = getActiveSessionSnapshot();
	if (dapSessionManager.getCapabilities()?.[capability] !== true) {
		throw new ToolError(`Current adapter does not support ${description}`);
	}
	return snapshot;
}

function resolveDisassemblyReference(memoryReference: string | undefined): string {
	if (memoryReference) {
		return memoryReference;
	}
	const snapshot = getActiveSessionSnapshot();
	if (snapshot.instructionPointerReference) {
		return snapshot.instructionPointerReference;
	}
	throw new ToolError(
		"disassemble requires memory_reference unless the current stop location has an instruction pointer reference",
	);
}

function summarizeDebugCall(args: DebugRenderArgs): string {
	const action = args.action ? args.action.replaceAll("_", " ") : "request";
	if (args.program) {
		return `${action} ${truncateToWidth(args.program, TRUNCATE_LENGTHS.TITLE)}`;
	}
	if (args.file && args.line !== undefined) {
		return `${action} ${truncateToWidth(`${args.file}:${args.line}`, TRUNCATE_LENGTHS.TITLE)}`;
	}
	if (args.function) {
		return `${action} ${truncateToWidth(args.function, TRUNCATE_LENGTHS.TITLE)}`;
	}
	if (args.expression) {
		return `${action} ${truncateToWidth(args.expression, TRUNCATE_LENGTHS.TITLE)}`;
	}

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass an explicit `memory_reference` argument (address or memory reference from evaluate/stack frames).
  2. Ensure the debuggee is paused at a breakpoint/stop whose location includes an instruction pointer reference, then retry without memory_reference.
  3. Pause or hit a breakpoint first (e.g. action=pause or set a breakpoint and continue) before disassembling.

Example fix

// before
debugTool({ action: "disassemble" })
// after
debugTool({ action: "disassemble", memory_reference: "0x7f8a2c000040" })
Defensive patterns

Strategy: validation

Validate before calling

if (!memoryReference) {
  const snap = await debugTool({ action: "snapshot" });
  if (!snap.instructionPointerReference) {
    throw new Error("paused at a stop with an IP reference or provide memory_reference first");
  }
}

Type guard

function canDisassemble(args: { memory_reference?: string }, snap?: { instructionPointerReference?: string }): boolean {
  return !!args.memory_reference || !!snap?.instructionPointerReference;
}

Try / catch

try {
  return await debugTool({ action: "disassemble", memory_reference });
} catch (e) {
  if (String(e).includes("disassemble requires memory_reference")) {
    await debugTool({ action: "pause" }); // ensure a stop, then retry
    return await debugTool({ action: "disassemble", memory_reference });
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling action=disassemble without `memory_reference` while the debuggee is not stopped at a location exposing an instruction pointer reference (either running, or stopped without such a reference).

Common situations: Requesting disassembly while the program is running (no current stop); the adapter doesn't provide an instructionPointerReference at the stop; the caller simply forgot to pass memory_reference; calling disassemble before the first breakpoint hit.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/0785d9b49ec4ecd4. Report an issue: GitHub.