can1357/oh-my-pi · error · ToolError

remove_breakpoint requires file+line or function

Error message

remove_breakpoint requires file+line or function

What it means

The debug tool's remove_breakpoint action throws this ToolError when neither file+line nor a function name is provided. The tool must know which breakpoint location to remove; without a locator it refuses to call the DAP session manager. Pure input-validation guard.

Source

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

					timeoutSec * 1000,
				);
				details.snapshot = response.snapshot;
				details.breakpoints = response.breakpoints;
				return result.text(formatBreakpoints(response.sourcePath, response.breakpoints)).done();
			}
			case "remove_breakpoint": {
				if (params.function) {
					const response = await dapSessionManager.removeFunctionBreakpoint(
						params.function,
						combinedSignal,
						timeoutSec * 1000,
					);
					details.snapshot = response.snapshot;
					details.functionBreakpoints = response.breakpoints;
					return result.text(formatFunctionBreakpoints(response.breakpoints)).done();
				}
				if (!params.file || params.line === undefined) {
					throw new ToolError("remove_breakpoint requires file+line or function");
				}
				const file = resolveToCwd(params.file, this.session.cwd);
				const response = await dapSessionManager.removeBreakpoint(
					file,
					params.line,
					combinedSignal,
					timeoutSec * 1000,
				);
				details.snapshot = response.snapshot;
				details.breakpoints = response.breakpoints;
				return result.text(formatBreakpoints(response.sourcePath, response.breakpoints)).done();
			}
			case "set_instruction_breakpoint": {
				requireCapability("supportsInstructionBreakpoints", "instruction breakpoints");
				if (!params.instruction_reference) {
					throw new ToolError("instruction_reference is required for set_instruction_breakpoint");
				}
				const response = await dapSessionManager.setInstructionBreakpoint(

View on GitHub (pinned to 9690622007)

Solutions

  1. Provide the same file+line used when the breakpoint was set
  2. Or provide the function name if the breakpoint was set as a function breakpoint
  3. List existing breakpoints first and echo back their exact file/line

Example fix

// before
await debugTool.run({ action: 'remove_breakpoint' });
// after
await debugTool.run({ action: 'remove_breakpoint', file: 'src/index.ts', line: 42 });
Defensive patterns

Strategy: validation

Validate before calling

function canRemoveBreakpoint(params) {
  return (typeof params.file === 'string' && params.file.length > 0 && Number.isInteger(params.line))
    || (typeof params.function === 'string' && params.function.length > 0);
}
if (!canRemoveBreakpoint(params)) throw new Error('remove_breakpoint needs file+line or function');

Type guard

function hasBreakpointLocation(p) {
  return typeof p === 'object' && p !== null
    && (typeof (p as { file?: unknown }).file === 'string'
      && typeof (p as { line?: unknown }).line === 'number'
      || typeof (p as { function?: unknown }).function === 'string');
}

Try / catch

try {
  await debugTool.run({ action: 'remove_breakpoint', ...params });
} catch (err) {
  if (err instanceof ToolError && err.message.includes('requires file+line or function')) {
    // fetch current breakpoints and retry with an exact location
  } else throw err;
}

Prevention

When it happens

Trigger: Calling action=remove_breakpoint with params.file empty/missing or params.line undefined and no function alternative supplied.

Common situations: Caller tries to clear all breakpoints by passing no fields (use a clear-all action instead); line number lost when echoing back breakpoint info; function name vs source location mismatch.

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/076126f9b9d10327. Report an issue: GitHub.