can1357/oh-my-pi · error · ToolError
Unknown tool from js runtime: ${name}
Error message
Unknown tool from js runtime: ${name} What it means
The eval tool bridge resolves tool names against the current `ToolSession` (via `getToolForEvalBridge` or `getToolByName`). When no tool with the requested name exists, `getTool` throws this `ToolError`. It surfaces to JS eval code that calls a session tool under a wrong/unknown name.
Source
Thrown at packages/coding-agent/src/eval/js/tool-bridge.ts:42
text: string;
details?: unknown;
images?: Array<{ mimeType: string; data: string }>;
hasError?: boolean;
};
function toolResultHasError(result: AgentToolResult): boolean {
if ((result as { isError?: unknown }).isError === true) {
return true;
}
if (!(result.details && typeof result.details === "object")) {
return false;
}
return (result.details as { isError?: unknown }).isError === true;
}
function getTool(session: ToolSession, name: string): AgentTool {
const tool = session.getToolForEvalBridge ? session.getToolForEvalBridge(name) : session.getToolByName?.(name);
if (!tool) {
throw new ToolError(`Unknown tool from js runtime: ${name}`);
}
return tool;
}
function normalizeArgs(args: unknown): unknown {
if (!args || typeof args !== "object" || Array.isArray(args)) {
return args;
}
const record = { ...(args as Record<string, unknown>) };
if (record[INTENT_FIELD] === undefined) {
record[INTENT_FIELD] = "js prelude";
}
return record;
}
function summarizeToolResult(
name: string,
args: unknown,View on GitHub (pinned to 9690622007)
Solutions
- Verify the exact tool name — list available tools from the session before calling
- Check agent/MCP config so the tool is actually registered and enabled
- Guard eval code: check tool availability (if supported) before invoking, or wrap the call in try-catch for ToolError
Example fix
// before
await tool("read_file", { path: "x.ts" });
// after
await tool("read", { filePath: "x.ts" }); // correct registered name Defensive patterns
Strategy: try-catch
Validate before calling
// discover valid tool names first
const names = session.tools?.map(t => t.name) ?? [];
if (!names.includes(name)) throw new Error(`Tool "${name}" not available; have: ${names.join(", ")}`); Try / catch
try {
await tool(name, args);
} catch (err) {
if (err instanceof ToolError && /Unknown tool from js runtime/.test(err.message)) {
// fall back to listing tools or a default tool
}
} Prevention
- List session tools before calling; never hardcode names from memory
- Check MCP server connectivity so its tools are registered
- Review allow-list/permission config that might filter out tools
When it happens
Trigger: Calling `tool("someName", ...)` or `callSessionTool` from JS eval code with a name that is not registered on the session (typo, tool disabled by config, or MCP server not connected).
Common situations: Typo in the tool name; a tool filtered out by permission/allow-list config; an MCP tool missing because the server failed to start; using a builtin name that only exists in other agent versions.
Related errors
- \`${name}\` cannot run through the eval bridge; call the dir
- agent() received invalid arguments: ${result.summary}
- agent() blocked: turn token budget exhausted (${turnBudget.s
- ${failureMessage}${recoveryHint} (subagent failure: ${policy
- agent() isolated apply failed for ${result.id}${summary ? `:
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/ec27d47fbe40e0db.
Report an issue: GitHub.