can1357/oh-my-pi · error · Error

Legacy EditToolOptions.operations is not supported: OMP's bu

Error message

Legacy EditToolOptions.operations is not supported: OMP's built-in edit tool writes the local filesystem natively and exposes no pluggable operations seam. Register a custom edit tool via defineTool() instead of passing operations to createEditTool()/createEditToolDefinition().

What it means

The legacy edit tool shim does not support the `operations` option from pi's EditToolOptions. OMP's built-in edit tool writes the local filesystem natively with no pluggable operations seam, so passing operations throws immediately at tool-definition time.

Source

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

			const sorted = [...entries].sort((a, b) => a.localeCompare(b));
			const limited = sorted.slice(0, limit);
			const output = limited.join("\n");
			const details = sorted.length > limited.length ? { entryLimitReached: limit } : undefined;
			const suffix = details ? `\n\n[${limit} entries limit reached]` : "";
			return { content: [{ type: "text", text: `${output}${suffix}` }], details };
		},
	});
}

/** Create the legacy ls tool. */
export function createLsTool(cwd: string, options?: LsToolOptions): ToolDefinition {
	return createLsToolDefinition(cwd, options);
}

/** Create the legacy edit tool definition. */
export function createEditToolDefinition(cwd: string, options?: EditToolOptions): ToolDefinition {
	if (options?.operations) {
		throw new Error(
			"Legacy EditToolOptions.operations is not supported: OMP's built-in edit tool writes the local " +
				"filesystem natively and exposes no pluggable operations seam. Register a custom edit tool via " +
				"defineTool() instead of passing operations to createEditTool()/createEditToolDefinition().",
		);
	}
	return legacyBuiltinTool(cwd, "edit");
}

/** Create the legacy edit tool. */
export function createEditTool(cwd: string, options?: EditToolOptions): ToolDefinition {
	return createEditToolDefinition(cwd, options);
}

/** Create the legacy write tool definition. */
export function createWriteToolDefinition(cwd: string, options?: WriteToolOptions): ToolDefinition {
	if (options?.operations) {
		throw new Error(
			"Legacy WriteToolOptions.operations is not supported: OMP's built-in write tool writes the local " +

View on GitHub (pinned to 9690622007)

Solutions

  1. Remove the `operations` field from the options object.
  2. Register a custom edit tool via defineTool() that uses your operations adapter.
  3. If you only needed sandboxing, run the agent with a working directory inside the sandbox instead.

Example fix

// before
createEditToolDefinition(cwd, { operations: myOps })
// after
createEditToolDefinition(cwd)
// or register a custom tool:
defineTool({ name: "edit", ..., execute: (args) => myOps.write(...) })
Defensive patterns

Strategy: validation

Validate before calling

if (options && "operations" in options && options.operations) {
  // route to a custom defineTool()-based edit tool instead
  registerCustomEditTool(operations);
} else {
  createEditToolDefinition(cwd, options);
}

Type guard

function hasOperations(o: EditToolOptions | undefined): o is EditToolOptions & { operations: NonNullable<EditToolOptions["operations"]> } {
  return !!o && !!o.operations;
}

Try / catch

let tool;
try {
  tool = createEditToolDefinition(cwd, options);
} catch (err) {
  if (err instanceof Error && err.message.includes("EditToolOptions.operations is not supported")) {
    tool = defineCustomEditTool(cwd, options.operations);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling createEditTool(cwd, { operations }) or createEditToolDefinition(cwd, { operations }) with a non-undefined `operations` field.

Common situations: Migrating code from the legacy pi coding-agent that injected a virtual/sandboxed filesystem adapter into built-in tools; copy-pasted options from read/ls tool creation where operations is still supported.

Related errors


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