can1357/oh-my-pi · error · ToolError

data_id is required for set_data_breakpoint

Error message

data_id is required for set_data_breakpoint

What it means

The set_data_breakpoint action throws this ToolError when params.data_id is missing. A data breakpoint watches a specific data_id returned by a prior data_breakpoint_info call; without it the adapter cannot identify what to watch. Capability supportsDataBreakpoints is required.

Source

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

				requireCapability("supportsDataBreakpoints", "data breakpoints");
				if (!params.name) {
					throw new ToolError("name is required for data_breakpoint_info");
				}
				const response = await dapSessionManager.dataBreakpointInfo(
					params.name,
					params.variable_ref ?? params.scope_id,
					params.frame_id,
					combinedSignal,
					timeoutSec * 1000,
				);
				details.snapshot = response.snapshot;
				details.dataBreakpointInfo = response.info;
				return result.text(formatDataBreakpointInfo(response.info)).done();
			}
			case "set_data_breakpoint": {
				requireCapability("supportsDataBreakpoints", "data breakpoints");
				if (!params.data_id) {
					throw new ToolError("data_id is required for set_data_breakpoint");
				}
				const response = await dapSessionManager.setDataBreakpoint(
					params.data_id,
					params.access_type,
					params.condition,
					params.hit_condition,
					combinedSignal,
					timeoutSec * 1000,
				);
				details.snapshot = response.snapshot;
				details.dataBreakpoints = response.breakpoints;
				return result.text(formatDataBreakpoints(response.breakpoints)).done();
			}
			case "remove_data_breakpoint": {
				requireCapability("supportsDataBreakpoints", "data breakpoints");
				if (!params.data_id) {
					throw new ToolError("data_id is required for remove_data_breakpoint");
				}

View on GitHub (pinned to 9690622007)

Solutions

  1. Call data_breakpoint_info with the variable name first and copy its returned data_id
  2. Pass that data_id to set_data_breakpoint along with access_type (read/write/readWrite) if desired
  3. If the info call returned no data IDs, the adapter cannot watch that expression — do not attempt set_data_breakpoint

Example fix

// before
await debugTool.run({ action: 'set_data_breakpoint', name: 'myVar', access_type: 'write' });
// after
const info = await debugTool.run({ action: 'data_breakpoint_info', name: 'myVar' });
await debugTool.run({ action: 'set_data_breakpoint', data_id: info.info.dataId, access_type: 'write' });
Defensive patterns

Strategy: validation

Validate before calling

if (typeof params.data_id !== 'string' || params.data_id.length === 0) {
  throw new Error('set_data_breakpoint needs data_id from data_breakpoint_info');
}

Type guard

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

Try / catch

try {
  await debugTool.run({ action: 'set_data_breakpoint', ...params });
} catch (err) {
  if (err instanceof ToolError && err.message.includes('data_id is required')) {
    // run data_breakpoint_info for the variable, extract dataId, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: Calling action=set_data_breakpoint with params.data_id undefined/empty — typically when the caller skips data_breakpoint_info and passes the variable name directly.

Common situations: Caller passes a variable name instead of the data_id from the info response; the info step was done in a previous session and the id is stale; params built from the wrong response object.

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