can1357/oh-my-pi · error · ToolError

${params.op} requires name

Error message

${params.op} requires name

What it means

requiredName() validates LaunchParams for operations that address a named daemon (stop, send, log, etc.). If `params.name` is empty/undefined it throws a ToolError '<op> requires name', telling the caller which operation is missing the required daemon name.

Source

Thrown at packages/coding-agent/src/tools/hub/launch.ts:173

/** Structured launch state retained for compact TUI rendering. */
export interface LaunchToolDetails {
	op: LaunchParams["op"];
	daemon?: DaemonSnapshot;
	daemons?: DaemonSnapshot[];
	cursor?: number;
	timedOut?: boolean;
	/** logs: daemon lifecycle state at read time. */
	state?: DaemonState;
	/** logs: virtual terminal rows for display; model-facing content remains sanitized text. */
	terminalRows?: string[];
	/** wait: output line that satisfied the pattern. */
	matched?: string;
	/** describe: immutable launch spec backing the command/cwd detail lines. */
	spec?: DaemonSpec;
}

function requiredName(params: LaunchParams): string {
	if (!params.name) throw new ToolError(`${params.op} requires name`);
	return params.name;
}

function timeoutMs(value: number | undefined, fallbackSeconds: number): number {
	const seconds = Math.max(0.05, Math.min(3_600, value ?? fallbackSeconds));
	return Math.round(seconds * 1_000);
}

function commandSpec(params: LaunchParams, session: ToolSession): DaemonSpec {
	const name = requiredName(params);
	if (!params.application) throw new ToolError("start requires application");
	const ready = params.ready;
	const detached = params.detached ?? false;
	if (ready?.port !== undefined && (!Number.isInteger(ready.port) || ready.port < 1 || ready.port > 65_535)) {
		throw new ToolError("ready.port must be an integer from 1 to 65535");
	}
	if (ready && !ready.log && ready.port === undefined) throw new ToolError("ready requires log or port");
	return {

View on GitHub (pinned to 9690622007)

Solutions

  1. Add the `name` parameter identifying the daemon for the given op.
  2. Verify the op actually needs a name — 'start' derives its name from params and does not go through this path.
  3. Check spelling/casing of the parameter (must be `name`).

Example fix

// before
launch({ op: "stop" })
// throws: stop requires name

// after
launch({ op: "stop", name: "dev-server" })
Defensive patterns

Strategy: validation

Validate before calling

if (!params.name?.trim()) throw new Error(`${params.op} requires name`);

Try / catch

try {
  await launchTool.run({ op: "stop", name });
} catch (err) {
  if (err instanceof ToolError && err.message.endsWith("requires name")) {
    // supply the daemon name and retry
  } else throw err;
}

Prevention

When it happens

Trigger: Calling the launch tool with an op such as 'stop', 'send', or 'log' but omitting the `name` parameter, or passing name: "".

Common situations: Model-generated tool args forgot the name field; code copies a start call and deletes name; template/automation builds params conditionally and the name branch was skipped.

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