can1357/oh-my-pi · error · Error

Path not found: ${absolutePath}

Error message

Path not found: ${absolutePath}

What it means

The legacy glob tool shim resolves the caller-supplied `path` parameter against the working directory and verifies it exists via the operations adapter before globbing. If `options.operations.exists(absolutePath)` returns false, it throws 'Path not found: <absolutePath>'. This guards the glob call against nonexistent roots.

Source

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

		label: "find",
		description: "Find files by glob pattern.",
		parameters: legacyFindSchema,
		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, "find")} ${themedMuted(theme, `${pattern} in ${searchPath}`)}`, 0, 0);
		},
		renderResult: legacyRenderResult,
		execute: async (toolCallId, params, signal, onUpdate) => {
			const pattern = stringField(params, "pattern") ?? "*";
			const searchPath = stringField(params, "path") ?? ".";
			const limit = normalizeLegacyLimit(numberField(params, "limit"), 1000);
			const absolutePath = path.resolve(cwd, searchPath);
			if (options?.operations) {
				if (!(await options.operations.exists(absolutePath))) {
					throw new Error(`Path not found: ${absolutePath}`);
				}
				const matches = await options.operations.glob(pattern, absolutePath, {
					ignore: ["**/node_modules/**", "**/.git/**"],
					limit,
				});
				const output = matches
					.map(match => {
						const rel = path.isAbsolute(match) ? path.relative(absolutePath, match) : match;
						return rel.split(path.sep).join("/");
					})
					.join("\n");
				const truncation = truncateHead(output, { maxLines: Number.MAX_SAFE_INTEGER });
				return {
					content: [{ type: "text", text: truncation.content || "No files found matching pattern" }],
					details: truncation.truncated ? { truncation } : undefined,
				};
			}
			return tool.execute(

View on GitHub (pinned to 9690622007)

Solutions

  1. Check the absolute path printed in the message and verify it exists (ls/stat it).
  2. Fix the `path` parameter passed to the tool — use an absolute path or confirm the session cwd.
  3. If using a custom operations adapter, ensure exists() correctly reflects the target filesystem.
  4. Create the missing directory if it was expected to exist.

Example fix

// before
glob({ pattern: "*.ts", path: "src/typo-dir" })
// after
glob({ pattern: "*.ts", path: "src" })
Defensive patterns

Strategy: validation

Validate before calling

import * as path from "node:path";
import * as fs from "node:fs/promises";
const absolutePath = path.resolve(cwd, searchPath);
await fs.access(absolutePath); // throws ENOENT early with your own message

Type guard

async function pathExists(p: string): Promise<boolean> {
  try { await fs.stat(p); return true; } catch { return false; }
}
if (!(await pathExists(absolutePath))) throw new Error(`Skipping glob: ${absolutePath} does not exist`);

Try / catch

try {
  await globTool.run({ pattern: "*.ts", path: "src" });
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Path not found:")) {
    // fall back to cwd or surface a corrected path
  } else throw err;
}

Prevention

When it happens

Trigger: Calling the legacy glob tool (createGlobTool / shim read path) with a `path` param that resolves to a directory that does not exist on disk, or when the injected operations adapter's `exists()` reports false (e.g. a virtual/in-memory FS missing the entry).

Common situations: Relative path typo or wrong working directory assumption; tool invoked by an LLM agent hallucinating a path; path deleted between planning and execution; custom operations seam whose exists() implementation is broken or scoped to a sandbox root.

Related errors


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