earendil-works/pi · error

Unknown tool name

Error message

Unknown tool name: ${toolName}

What it means

Exhausted-switch guard in createToolDefinition: the requested tool name does not match any case in the built-in tool factory (read/bash/edit/write/grep/find/ls/...). The caller asked for a tool this build does not know, likely a typo or an unregistered built-in name.

Solutions

  1. Pass one of the known built-in ToolName values
  2. Register the tool as an extension instead of requesting an unknown built-in
  3. Check for typos in the tool name string
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/tools/index.ts:113 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/28f0575503241060. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/tools/index.ts:113

export function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef {
	switch (toolName) {
		case "read":
			return createReadToolDefinition(cwd, options?.read);
		case "bash":
			return createBashToolDefinition(cwd, options?.bash);
		case "edit":
			return createEditToolDefinition(cwd, options?.edit);
		case "write":
			return createWriteToolDefinition(cwd, options?.write);
		case "grep":
			return createGrepToolDefinition(cwd, options?.grep);
		case "find":
			return createFindToolDefinition(cwd, options?.find);
		case "ls":
			return createLsToolDefinition(cwd, options?.ls);
		default:
			throw new Error(`Unknown tool name: ${toolName}`);
	}
}

export function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool {
	switch (toolName) {
		case "read":
			return createReadTool(cwd, options?.read);
		case "bash":
			return createBashTool(cwd, options?.bash);
		case "edit":
			return createEditTool(cwd, options?.edit);
		case "write":
			return createWriteTool(cwd, options?.write);
		case "grep":
			return createGrepTool(cwd, options?.grep);
		case "find":
			return createFindTool(cwd, options?.find);
		case "ls":

View on GitHub (pinned to 4af9d21d3b)