can1357/oh-my-pi · error · ToolError
command is required for custom_request
Error message
command is required for custom_request
What it means
The debug tool's custom_request action forwards an arbitrary DAP command (and optional arguments) to the debug adapter via customRequest. Because the command name is mandatory — the adapter has nothing to dispatch without it — the tool throws this ToolError when params.command is missing or empty. Unlike the typed actions, this branch has no capability precheck, so parameter validation is the only guard.
Source
Thrown at packages/coding-agent/src/tools/debug.ts:1086
params.start_module,
params.module_count,
combinedSignal,
timeoutSec * 1000,
);
details.snapshot = response.snapshot;
details.modules = response.modules;
return result.text(formatModules(response.modules)).done();
}
case "loaded_sources": {
requireCapability("supportsLoadedSourcesRequest", "loaded sources");
const response = await dapSessionManager.loadedSources(combinedSignal, timeoutSec * 1000);
details.snapshot = response.snapshot;
details.sources = response.sources;
return result.text(formatLoadedSources(response.sources)).done();
}
case "custom_request": {
if (!params.command) {
throw new ToolError("command is required for custom_request");
}
const response = await dapSessionManager.customRequest(
params.command,
params.arguments,
combinedSignal,
timeoutSec * 1000,
);
details.snapshot = response.snapshot;
details.customBody = response.body;
return result.text(formatCustomResponse(params.command, response.body)).done();
}
case "output": {
const response = dapSessionManager.getOutput();
details.snapshot = response.snapshot;
details.output = response.output;
return result.text(response.output.length > 0 ? response.output : "(no output captured)").done();
}
case "terminate": {View on GitHub (pinned to 9690622007)
Solutions
- Set params.command to the DAP request name string, e.g. command: "myVendorCustomRequest".
- Put any payload in params.arguments, not in command — command must be a plain string.
- Check the parameter key spelling (command, not method/request/name).
- If a built-in action exists for your intent (set_breakpoints, evaluate, read_memory, …), use it instead of custom_request.
Example fix
// before
await debugTool.run({ action: "custom_request", arguments: { threads: true } });
// after
await debugTool.run({ action: "custom_request", command: "myCustomThreads", arguments: {} }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof command !== "string" || command.length === 0) throw new Error("custom_request requires a DAP command name string"); Type guard
function hasCommand(p: { command?: string }): p is { command: string } {
return typeof p.command === "string" && p.command.length > 0;
} Try / catch
try {
await debugTool.run({ action: "custom_request", command: dapCommand, arguments: args });
} catch (err) {
if (err instanceof ToolError && err.message.includes("command is required")) {
// move the request name out of arguments into the command field and retry
} else throw err;
} Prevention
- Remember custom_request has two fields: command (string, required) and arguments (object, optional).
- Prefer built-in tool actions over custom_request whenever one exists.
- Consult the adapter's vendor documentation for the exact DAP command name before calling.
When it happens
Trigger: Calling action="custom_request" with params.command undefined, null, or empty string; also when the DAP command name is placed under a wrong key (method, request, name) or supplied only inside params.arguments.
Common situations: Trying vendor-specific DAP extensions (e.g. custom breakpoint or evaluate variants) where the caller put the command into arguments instead of command; scripted calls built dynamically that skipped the command field; confusion between the tool action name and the DAP command string.
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
- memory_reference is required for read_memory
- count is required for read_memory
- memory_reference is required for write_memory
- data is required for write_memory
- Debugger reported no threads.
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/9d0db20f45a90999.
Report an issue: GitHub.