can1357/oh-my-pi · error · Error

runInTerminal request did not include a command

Error message

runInTerminal request did not include a command

What it means

When the adapter sends a runInTerminal reverse request, it must supply the command to execute in args.args. The handler spawns that command in the session's terminal; if the args array is missing or empty there is nothing to spawn, so it throws back to the adapter rather than attempting an undefined execution.

Source

Thrown at packages/coding-agent/src/dap/session.ts:1372

			breakpointMutationQueue: Promise.resolve(),
			outputChunks: [],
			outputBytes: 0,
			outputBufferedBytes: 0,
			outputTruncated: false,
			stop: {},
			threads: [],
			lastStackFrames: [],
			initializedSeen: false,
			needsConfigurationDone: false,
			configurationDoneSent: false,
			parentSessionId,
			childSessionIds: new Set(),
			port: client.port,
		};
		client.onReverseRequest("runInTerminal", async rawArgs => {
			const args = (rawArgs ?? {}) as DapRunInTerminalArguments;
			if (!Array.isArray(args.args) || args.args.length === 0) {
				throw new Error("runInTerminal request did not include a command");
			}
			const env = Object.fromEntries(
				Object.entries(args.env ?? {}).filter((entry): entry is [string, string] => entry[1] !== null),
			);
			const proc = ptree.spawn(args.args, {
				cwd: path.resolve(session.cwd, args.cwd ?? "."),
				stdin: "pipe",
				env: {
					...Bun.env,
					...NON_INTERACTIVE_ENV,
					...env,
				},
				detached: true,
			});
			// Consume the child's stdout — ptree pipes it but drains only stderr,
			// so an unconsumed stream buffers unboundedly in this process.
			void drainTerminalStdout(proc.stdout, session);
			return { processId: proc.pid } satisfies DapRunInTerminalResponse;

View on GitHub (pinned to 9690622007)

Solutions

  1. Update or fix the debug adapter so it sends a proper runInTerminal request with args array (argv form)
  2. Check adapter version compatibility with the DAP spec and switch to a supported adapter version
  3. If using a custom adapter, populate args (e.g. ['node', 'program.js']) and include cwd/env as needed
  4. Avoid adapter configurations that require runInTerminal (use internalConsole) if the adapter cannot supply commands

Example fix

// adapter side, before
send({ command: 'runInTerminal', arguments: { kind: 'integrated', title: 'debug' } });
// after
send({ command: 'runInTerminal', arguments: { kind: 'integrated', title: 'debug', args: ['node', 'app.js'], cwd: '...', env: {} } });
Defensive patterns

Strategy: try-catch

Validate before calling

if (!Array.isArray(rtArgs.args) || rtArgs.args.length === 0) {
  console.error('adapter sent runInTerminal without a command; adapter version unsupported');
}

Type guard

function hasRunInTerminalCommand(args: unknown): args is { args: string[]; cwd?: string; env?: Record<string, string | null> } {
  return typeof args === 'object' && args !== null && Array.isArray((args as { args?: unknown }).args) && (args as { args: unknown[] }).args.length > 0;
}

Try / catch

client.onReverseRequest('runInTerminal', async rawArgs => {
  try {
    await spawnInTerminal(rawArgs);
  } catch (err) {
    if (String((err as Error).message).includes('did not include a command')) {
      return { processId: undefined }; // report failure back to the adapter gracefully
    }
    throw err;
  }
});

Prevention

When it happens

Trigger: Adapter sends runInTerminal reverse request with args undefined, or args.args missing/not an array, or an empty array; malformed/misbehaving adapter that does not follow the DAP runInTerminal schema; custom adapter implementations that pass console/command in the wrong field.

Common situations: Third-party or older adapter versions that don't populate runInTerminal args correctly; adapter configured for 'integratedTerminal' console but sends an empty command; custom debug adapters built against a different DAP version.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/ec9b18ceff90d78e. Report an issue: GitHub.