can1357/oh-my-pi · error · ToolError

instruction_reference is required for remove_instruction_bre

Error message

instruction_reference is required for remove_instruction_breakpoint

What it means

The remove_instruction_breakpoint action throws this ToolError when params.instruction_reference is missing. Removing an instruction breakpoint requires the same instruction address reference used to set it. Validation guard before the DAP removeInstructionBreakpoint request.

Source

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

				if (!params.instruction_reference) {
					throw new ToolError("instruction_reference is required for set_instruction_breakpoint");
				}
				const response = await dapSessionManager.setInstructionBreakpoint(
					params.instruction_reference,
					params.offset,
					params.condition,
					params.hit_condition,
					combinedSignal,
					timeoutSec * 1000,
				);
				details.snapshot = response.snapshot;
				details.instructionBreakpoints = response.breakpoints;
				return result.text(formatInstructionBreakpoints(response.breakpoints)).done();
			}
			case "remove_instruction_breakpoint": {
				requireCapability("supportsInstructionBreakpoints", "instruction breakpoints");
				if (!params.instruction_reference) {
					throw new ToolError("instruction_reference is required for remove_instruction_breakpoint");
				}
				const response = await dapSessionManager.removeInstructionBreakpoint(
					params.instruction_reference,
					params.offset,
					combinedSignal,
					timeoutSec * 1000,
				);
				details.snapshot = response.snapshot;
				details.instructionBreakpoints = response.breakpoints;
				return result.text(formatInstructionBreakpoints(response.breakpoints)).done();
			}
			case "data_breakpoint_info": {
				requireCapability("supportsDataBreakpoints", "data breakpoints");
				if (!params.name) {
					throw new ToolError("name is required for data_breakpoint_info");
				}
				const response = await dapSessionManager.dataBreakpointInfo(
					params.name,

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass the exact instruction_reference used when the breakpoint was set
  2. List current instruction breakpoints (via snapshot/breakpoint listing) and copy the reference from there
  3. If unsure of the address, disassemble around the region to recover the instructionAddress

Example fix

// before
await debugTool.run({ action: 'remove_instruction_breakpoint', offset: 4 });
// after
await debugTool.run({ action: 'remove_instruction_breakpoint', instruction_reference: '0x00400a1b' });
Defensive patterns

Strategy: validation

Validate before calling

if (typeof params.instruction_reference !== 'string' || params.instruction_reference.length === 0) {
  throw new Error('remove_instruction_breakpoint needs instruction_reference');
}

Type guard

function hasInstructionReference(p) {
  return typeof p === 'object' && p !== null
    && typeof (p as { instruction_reference?: unknown }).instruction_reference === 'string'
    && (p as { instruction_reference: string }).instruction_reference.length > 0;
}

Try / catch

try {
  await debugTool.run({ action: 'remove_instruction_breakpoint', ...params });
} catch (err) {
  if (err instanceof ToolError && err.message.includes('instruction_reference is required')) {
    // list current instruction breakpoints to recover the reference, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: Calling action=remove_instruction_breakpoint without instruction_reference or with an empty value.

Common situations: Caller only remembers the offset but not the base reference; assumes removal by index/offset alone; instruction breakpoints were set in a different session so the reference is unknown.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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