can1357/oh-my-pi · error · ToolError
program is required for launch
Error message
program is required for launch
What it means
The launch action requires a `program` parameter identifying what to debug. execute checks `!params.program` in the launch case and throws before any adapter resolution occurs. Without a program there is no target for the DAP adapter to launch.
Source
Thrown at packages/coding-agent/src/tools/debug.ts:740
return session.settings.get("debug.enabled") ? new DebugTool(session) : null;
}
async execute(
_toolCallId: string,
params: DebugParams,
signal?: AbortSignal,
_onUpdate?: AgentToolUpdateCallback<DebugToolDetails>,
_context?: AgentToolContext,
): Promise<AgentToolResult<DebugToolDetails>> {
const timeoutSec = clampTimeout("debug", params.timeout, this.session.settings.get("tools.maxTimeout"));
const timeoutSignal = AbortSignal.timeout(timeoutSec * 1000);
const combinedSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
const details: DebugToolDetails = { action: params.action, success: true };
const result = toolResult(details);
switch (params.action) {
case "launch": {
if (!params.program) {
throw new ToolError("program is required for launch");
}
const commandCwd = params.cwd ? resolveToCwd(params.cwd, this.session.cwd) : this.session.cwd;
const program = resolveToCwd(params.program, commandCwd);
const programKind = await classifyLaunchProgram(program);
const selection = selectLaunchAdapter(program, commandCwd, params.adapter, programKind);
if (selection.kind === "unavailable") {
throw new ToolError(formatAdapterUnavailable(selection.adapterName, selection.command, commandCwd));
}
if (selection.kind === "none") {
throw new ToolError(
`No debugger adapter available. Installed adapters: ${getConfiguredAdapters(commandCwd)}`,
);
}
const { adapter } = selection;
validateLaunchProgram(program, commandCwd, programKind, adapter);
const extraLaunchArguments = resolveLaunchOverrides(adapter, program, programKind);
const snapshot = await dapSessionManager.launch(
{ adapter, program, args: params.args, cwd: commandCwd, extraLaunchArguments },View on GitHub (pinned to 9690622007)
Solutions
- Add the `program` parameter with the executable/entry-file path.
- If you intended to debug an already-running process, use action="attach" with `pid` or `port` instead.
- If launching needs a working directory too, set `cwd` alongside `program`.
Example fix
// before
{ "action": "launch" }
// after
{ "action": "launch", "program": "./src/main.py", "cwd": "./src" } Defensive patterns
Strategy: validation
Validate before calling
function assertLaunchArgs(params: { action: string; program?: string }): asserts params is { action: "launch"; program: string } {
if (params.action === "launch" && !params.program) throw new Error("program required for launch");
} Type guard
function hasProgram(p: { program?: string }): p is { program: string } & typeof p {
return typeof p.program === "string" && p.program.length > 0;
} Try / catch
try {
return await debugTool({ action: "launch", program });
} catch (e) {
if (String(e).includes("program is required for launch")) {
return await debugTool({ action: "attach", pid }); // attach semantics instead
}
throw e;
} Prevention
- Validate tool-call params against the action's required fields before dispatching.
- Use typed discriminated unions for launch vs attach argument shapes.
- Default program from project entry-point conventions in your automation.
When it happens
Trigger: Calling the debug tool with action="launch" but omitting the `program` parameter (or passing an empty string/undefined).
Common situations: Copy-pasting a tool invocation meant for attach (which uses pid/port) into launch; the orchestrating agent filled args for the wrong action; a config-driven invocation where the program field was dropped.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- attach requires pid or port
- launch program resolves to a directory: ${displayPath}. Pass
- disassemble requires memory_reference unless the current sto
- Pass at least one model selector, e.g. `omp bench opus gpt-5
- No snippet provided. Pass inline text, --file <path>, or pip
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/fefafeb9464e8ee2.
Report an issue: GitHub.