can1357/oh-my-pi · error · ToolError

Path not found: ${partition.missing.join(", ")}

Error message

Path not found: ${partition.missing.join(", ")}

What it means

For multi-path find calls without custom ops, the tool partitions paths into existing vs missing via partitionExistingPaths. If EVERY path is missing (partition.valid.length === 0), nothing can be searched, so it throws listing all missing paths — unlike the single-path case which keeps ENOENT semantics.

Source

Thrown at packages/coding-agent/src/tools/glob.ts:267

				if (!resource.sourcePath) {
					throw new ToolError(`Cannot find internal URL without a backing file: ${rawPattern}`);
				}
				normalizedPatterns.push(resource.sourcePath);
			}
			if (normalizedPatterns.some(pattern => pattern.length === 0)) {
				throw new ToolError("`path` must contain non-empty globs or paths");
			}

			// Tolerate missing entries in a multi-path call: skip ones whose base
			// directory is gone, and only error if every entry is missing. Single
			// missing path keeps the original ENOENT semantics — the user explicitly
			// asked about that one path, so silent empty results would be misleading.
			let missingPaths: string[] = [];
			let effectivePatterns = normalizedPatterns;
			if (normalizedPatterns.length > 1 && !this.#customOps) {
				const partition = await partitionExistingPaths(normalizedPatterns, this.session.cwd, parseFindPattern);
				if (partition.valid.length === 0) {
					throw new ToolError(`Path not found: ${partition.missing.join(", ")}`);
				}
				effectivePatterns = partition.valid;
				missingPaths = partition.missing;
			}

			const multiPattern = await resolveExplicitFindPatterns(effectivePatterns, this.session.cwd);
			const isSingle = !multiPattern;
			const targets: GlobTarget[] = multiPattern
				? multiPattern.targets.map(target => ({
						searchPath: resolveToCwd(target.basePath, this.session.cwd),
						globPattern: target.globPattern,
						hasGlob: target.hasGlob,
					}))
				: [
						(() => {
							const parsed = parseFindPattern(effectivePatterns[0] ?? ".");
							return {
								searchPath: resolveToCwd(parsed.basePath, this.session.cwd),

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify the paths exist relative to session.cwd (ls them first)
  2. Run from the correct working directory or pass absolute paths
  3. Fix path spelling/structure; at least one path must exist for a multi-path call

Example fix

// before
await findTool({ path: ["srce", "docz"] }); // both missing
// after
await findTool({ path: ["src", "docs"] });
Defensive patterns

Strategy: validation

Validate before calling

import * as fs from "node:fs/promises";
const existing: string[] = [];
for (const p of paths) {
  try { await fs.stat(path.resolve(cwd, p)); existing.push(p); } catch { /* skip */ }
}
if (existing.length === 0) throw new Error(`all paths missing: ${paths.join(", ")}`);

Try / catch

try {
  await globTool({ path: entries });
} catch (err) {
  if (err instanceof ToolError && err.message.startsWith("Path not found:")) {
    const missing = err.message.slice("Path not found: ".length).split(", ");
    // verify cwd and retry with corrected paths
  } else throw err;
}

Prevention

When it happens

Trigger: Calling find with multiple path entries where none exist on disk relative to cwd — all entries fail stat/existence checks in partitionExistingPaths.

Common situations: Running from the wrong working directory so relative paths don't resolve; typos in several directory names; a moved/renamed project layout; CI checkout missing the referenced dirs.

Related errors


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