can1357/oh-my-pi · error · Error

Legacy GrepToolOptions.operations is not supported: the buil

Error message

Legacy GrepToolOptions.operations is not supported: the built-in grep tool searches the local filesystem natively and exposes no pluggable filesystem seam (the historical seam only customized context-line reads; the search itself always ran locally). Register a custom grep tool via defineTool() instead of passing operations to createGrepTool()/createGrepToolDefinition().

What it means

The legacy grep tool shim no longer accepts the GrepToolOptions.operations pluggable-filesystem seam. The historical seam only customized context-line reads — the search itself always ran locally — so passing operations now throws an explanatory error directing users to register a custom tool instead.

Source

Thrown at packages/coding-agent/src/extensibility/legacy-pi-coding-agent-shim.ts:555

					env: spawn?.env,
					timeout,
				},
				signal,
				onUpdate,
			);
		},
	});
}

/** Create the legacy bash tool. */
export function createBashTool(cwd: string, options?: BashToolOptions): ToolDefinition {
	return createBashToolDefinition(cwd, options);
}

/** Create the legacy grep tool definition. */
export function createGrepToolDefinition(cwd: string, options?: GrepToolOptions): ToolDefinition {
	if (options?.operations) {
		throw new Error(
			"Legacy GrepToolOptions.operations is not supported: the built-in grep tool searches the local " +
				"filesystem natively and exposes no pluggable filesystem seam (the historical seam only customized " +
				"context-line reads; the search itself always ran locally). Register a custom grep tool via " +
				"defineTool() instead of passing operations to createGrepTool()/createGrepToolDefinition().",
		);
	}
	const tool = createRegistryTool(cwd, "grep");
	return markToolDefinition({
		name: "grep",
		label: "grep",
		description: "Search file contents for a pattern.",
		parameters: legacyGrepSchema,
		approval: "read",
		renderCall: (params, optionsArg, themeArg) => {
			const theme = renderTheme(optionsArg, themeArg);
			const pattern = stringField(params, "pattern") ?? "";
			const searchPath = stringField(params, "path") ?? ".";
			return new Text(`${themedTitle(theme, "grep")} ${themedMuted(theme, `/${pattern}/ in ${searchPath}`)}`, 0, 0);

View on GitHub (pinned to 9690622007)

Solutions

  1. Remove the operations property from GrepToolOptions to use the native local grep
  2. Implement a custom grep tool with defineTool() and register it for non-local filesystems
  3. If only context-line customization is needed, note the search was always local — restructure around the native tool
  4. Pin to the legacy version only as a temporary migration measure

Example fix

// before
createGrepTool(cwd, { operations: myReadOps });
// after
createGrepTool(cwd);
// or register a custom tool:
defineTool({ name: 'my-grep', ..., execute: ... });
Defensive patterns

Strategy: validation

Validate before calling

if (options && 'operations' in options) throw new Error('GrepToolOptions.operations removed: use createGrepTool(cwd) or defineTool() for custom grep');

Try / catch

try { const tool = createGrepToolDefinition(cwd, options); } catch (err) {
  if (err instanceof Error && err.message.includes('GrepToolOptions.operations is not supported')) {
    const tool = createGrepToolDefinition(cwd); // drop the legacy option
  } else throw err;
}

Prevention

When it happens

Trigger: Calling createGrepTool()/createGrepToolDefinition() with options.operations set; porting old pi-coding-agent code that supplied custom read operations for grep context lines.

Common situations: Migrating legacy integrations after upgrading to the new extensibility API; code that wrapped remote/virtual filesystems via the old seam.

Related errors


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