can1357/oh-my-pi · error · ToolError

set_breakpoint requires file+line or function

Error message

set_breakpoint requires file+line or function

What it means

The debug tool's set_breakpoint action throws this ToolError when neither a file+line pair nor a function name is supplied. Setting a source breakpoint requires a location; the DAP session manager cannot place a breakpoint without one. This is an input-validation guard before any DAP request is issued.

Source

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

				);
				details.snapshot = snapshot;
				details.adapter = adapter.name;
				return result.text(formatSessionSnapshot(snapshot).join("\n")).done();
			}
			case "set_breakpoint": {
				if (params.function) {
					const response = await dapSessionManager.setFunctionBreakpoint(
						params.function,
						params.condition,
						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("set_breakpoint requires file+line or function");
				}
				const file = resolveToCwd(params.file, this.session.cwd);
				const response = await dapSessionManager.setBreakpoint(
					file,
					params.line,
					params.condition,
					combinedSignal,
					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,

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass both file (path) and line (1-based number) in params, e.g. {file: 'src/index.ts', line: 42}
  2. Or pass function instead of file+line to set a function breakpoint
  3. Check the tool schema for set_breakpoint to confirm required fields before calling

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
  await debugTool.run({ action: 'set_breakpoint', ...params });
} catch (err) {
  if (err instanceof ToolError && err.message.includes('requires file+line or function')) {
    // re-invoke with a complete location or surface a usage hint
  } else throw err;
}

Prevention

When it happens

Trigger: Calling the debug tool with action=set_breakpoint and params where params.file is empty/missing or params.line is undefined, and the function branch (params.function) was not taken.

Common situations: Agent omits the line number when setting a breakpoint on a file; caller passes line: 0 or null thinking it means 'whole file'; caller only provides a condition without a location; schema drift between tool caller and tool definition.

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/13c71c53e7bd2cb3. Report an issue: GitHub.