can1357/oh-my-pi · error · ToolError
instruction_count is required for disassemble
Error message
instruction_count is required for disassemble
What it means
The disassemble action throws this ToolError when params.instruction_count is undefined. Disassembly is bounded by an explicit instruction count; the tool refuses an unbounded request. The adapter capability supportsDisassembleRequest is checked before this validation.
Source
Thrown at packages/coding-agent/src/tools/debug.ts:1001
const response = await dapSessionManager.scopes(params.frame_id, combinedSignal, timeoutSec * 1000);
details.snapshot = response.snapshot;
details.scopes = response.scopes;
return result.text(formatScopes(response.scopes)).done();
}
case "variables": {
const variableReference = params.variable_ref ?? params.scope_id;
if (variableReference === undefined) {
throw new ToolError("variables requires variable_ref or scope_id");
}
const response = await dapSessionManager.variables(variableReference, combinedSignal, timeoutSec * 1000);
details.snapshot = response.snapshot;
details.variables = response.variables;
return result.text(formatVariables(response.variables)).done();
}
case "disassemble": {
requireCapability("supportsDisassembleRequest", "disassembly");
if (params.instruction_count === undefined) {
throw new ToolError("instruction_count is required for disassemble");
}
const response = await dapSessionManager.disassemble(
resolveDisassemblyReference(params.memory_reference),
params.instruction_count,
params.offset,
params.instruction_offset,
params.resolve_symbols,
combinedSignal,
timeoutSec * 1000,
);
details.snapshot = response.snapshot;
details.disassembly = response.instructions;
return result.text(formatDisassembly(response.instructions)).done();
}
case "read_memory": {
requireCapability("supportsReadMemoryRequest", "memory reads");
if (!params.memory_reference) {
throw new ToolError("memory_reference is required for read_memory");View on GitHub (pinned to 9690622007)
Solutions
- Pass instruction_count (positive integer), e.g. {memory_reference: '0x00400a10', instruction_count: 32}
- Provide memory_reference (or a prior instruction address) to anchor the disassembly region
- Keep instruction_count modest; use instruction_offset to page through larger regions
Example fix
// before
await debugTool.run({ action: 'disassemble', memory_reference: '0x00400a10' });
// after
await debugTool.run({ action: 'disassemble', memory_reference: '0x00400a10', instruction_count: 32 }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof params.instruction_count !== 'number' || !Number.isInteger(params.instruction_count) || params.instruction_count <= 0) {
throw new Error('disassemble needs a positive integer instruction_count');
} Type guard
function hasInstructionCount(p) {
const c = (p as { instruction_count?: unknown }).instruction_count;
return typeof p === 'object' && p !== null && typeof c === 'number' && Number.isInteger(c) && c > 0;
} Try / catch
try {
await debugTool.run({ action: 'disassemble', ...params });
} catch (err) {
if (err instanceof ToolError && err.message.includes('instruction_count is required')) {
// retry with an explicit window size, e.g. instruction_count: 32
} else throw err;
} Prevention
- Always specify a bounded instruction_count; there is no default window
- Anchor with memory_reference from a prior frame or disassemble result
- Use instruction_offset for paging instead of growing the count unboundedly
- Verify supportsDisassembleRequest capability before calling
When it happens
Trigger: Calling action=disassemble without params.instruction_count (or with undefined); memory_reference and offsets are optional but count is not.
Common situations: Caller assumes a default window of instructions exists; params object built conditionally drops the count; confusion between instruction_offset (positioning) and instruction_count (window size).
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
- disassemble requires memory_reference unless the current sto
- set_breakpoint requires file+line or function
- remove_breakpoint requires file+line or function
- instruction_reference is required for set_instruction_breakp
- instruction_reference is required for remove_instruction_bre
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/794d2ad539419fa6.
Report an issue: GitHub.