can1357/oh-my-pi · error · ToolError

Eval tool requires a session when not using proxy executor

Error message

Eval tool requires a session when not using proxy executor

What it means

EvalTool can be constructed with session = null when it is backed by a proxyExecutor (e.g. remote/bridge transports). execute() first delegates to the proxy executor; if no proxy executor is wired AND the session is null, there is no way to run the cell, so it throws. This is an internal wiring/invariant error, not a user-input problem.

Source

Thrown at packages/coding-agent/src/tools/eval.ts:462

		private readonly session: ToolSession | null,
		options?: EvalToolOptions,
	) {
		this.#proxyExecutor = options?.proxyExecutor;
	}

	async execute(
		_toolCallId: string,
		params: typeof evalSchema.infer,
		signal?: AbortSignal,
		onUpdate?: AgentToolUpdateCallback,
		ctx?: AgentToolContext,
	): Promise<AgentToolResult<EvalToolDetails | undefined>> {
		if (this.#proxyExecutor) {
			return this.#proxyExecutor(params, signal);
		}

		if (!this.session) {
			throw new ToolError("Eval tool requires a session when not using proxy executor");
		}
		const session = this.session;
		const excludeWebP = webpExclusionForModel(session.getActiveModel?.());

		const cellLanguage: EvalLanguage =
			params.language === "py"
				? "python"
				: params.language === "rb"
					? "ruby"
					: params.language === "jl"
						? "julia"
						: "js";
		// Bound backend discovery by the eval cell's own timeout and abort signal:
		// the cell IdleTimeout is armed only later in #runCells, so a hung runtime
		// probe would otherwise wedge the whole turn (issue #9466).
		const cellTimeoutMs =
			params.timeout === 0
				? 0

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass a valid ToolSession to the EvalTool constructor.
  2. Alternatively supply an explicit proxyExecutor: new EvalTool(null, { proxyExecutor }).
  3. If using the SDK's tool factory, use createTools()/the standard registry rather than hand-constructing EvalTool.

Example fix

// before
const tool = new EvalTool(null);
// after
const tool = new EvalTool(session);
// or
const tool = new EvalTool(null, { proxyExecutor: myProxy });
Defensive patterns

Strategy: validation

Validate before calling

if (!session && !options?.proxyExecutor) {
  throw new Error("EvalTool needs a session or a proxyExecutor");
}
const tool = new EvalTool(session, options);

Type guard

function isUsableEvalTool(t: EvalTool): boolean { return t["session"] !== null; } // or expose an isProxy/hasSession accessor

Try / catch

try {
  await evalTool.execute(id, params, signal);
} catch (e) {
  if (e instanceof ToolError && e.message.includes("requires a session")) {
    // re-create the tool with a session or proxy executor, then retry once
  } else throw e;
}

Prevention

When it happens

Trigger: Instantiating `new EvalTool(null)` without passing { proxyExecutor } in options and then calling execute(); or calling execute on a proxy-mode EvalTool instance where the proxyExecutor was not supplied.

Common situations: Embedding the coding-agent SDK and constructing tools manually without a ToolSession; test harnesses building EvalTool with null session and forgetting the proxyExecutor option; version changes where the proxy executor wiring moved.

Related errors


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