{"record":{"id":"e07053293457e02f","repo":"can1357/oh-my-pi","slug":"path-not-found-partition-missing-join","errorCode":null,"errorMessage":"Path not found: ${partition.missing.join(\", \")}","messagePattern":"Path not found: (.+?)","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/glob.ts","lineNumber":267,"sourceCode":"\t\t\t\tif (!resource.sourcePath) {\n\t\t\t\t\tthrow new ToolError(`Cannot find internal URL without a backing file: ${rawPattern}`);\n\t\t\t\t}\n\t\t\t\tnormalizedPatterns.push(resource.sourcePath);\n\t\t\t}\n\t\t\tif (normalizedPatterns.some(pattern => pattern.length === 0)) {\n\t\t\t\tthrow new ToolError(\"`path` must contain non-empty globs or paths\");\n\t\t\t}\n\n\t\t\t// Tolerate missing entries in a multi-path call: skip ones whose base\n\t\t\t// directory is gone, and only error if every entry is missing. Single\n\t\t\t// missing path keeps the original ENOENT semantics — the user explicitly\n\t\t\t// asked about that one path, so silent empty results would be misleading.\n\t\t\tlet missingPaths: string[] = [];\n\t\t\tlet effectivePatterns = normalizedPatterns;\n\t\t\tif (normalizedPatterns.length > 1 && !this.#customOps) {\n\t\t\t\tconst partition = await partitionExistingPaths(normalizedPatterns, this.session.cwd, parseFindPattern);\n\t\t\t\tif (partition.valid.length === 0) {\n\t\t\t\t\tthrow new ToolError(`Path not found: ${partition.missing.join(\", \")}`);\n\t\t\t\t}\n\t\t\t\teffectivePatterns = partition.valid;\n\t\t\t\tmissingPaths = partition.missing;\n\t\t\t}\n\n\t\t\tconst multiPattern = await resolveExplicitFindPatterns(effectivePatterns, this.session.cwd);\n\t\t\tconst isSingle = !multiPattern;\n\t\t\tconst targets: GlobTarget[] = multiPattern\n\t\t\t\t? multiPattern.targets.map(target => ({\n\t\t\t\t\t\tsearchPath: resolveToCwd(target.basePath, this.session.cwd),\n\t\t\t\t\t\tglobPattern: target.globPattern,\n\t\t\t\t\t\thasGlob: target.hasGlob,\n\t\t\t\t\t}))\n\t\t\t\t: [\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tconst parsed = parseFindPattern(effectivePatterns[0] ?? \".\");\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tsearchPath: resolveToCwd(parsed.basePath, this.session.cwd),","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/glob.ts#L249-L285","documentation":"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.","triggerScenarios":"Calling find with multiple path entries where none exist on disk relative to cwd — all entries fail stat/existence checks in partitionExistingPaths.","commonSituations":"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.","solutions":["Verify the paths exist relative to session.cwd (ls them first)","Run from the correct working directory or pass absolute paths","Fix path spelling/structure; at least one path must exist for a multi-path call"],"exampleFix":"// before\nawait findTool({ path: [\"srce\", \"docz\"] }); // both missing\n// after\nawait findTool({ path: [\"src\", \"docs\"] });","handlingStrategy":"validation","validationCode":"import * as fs from \"node:fs/promises\";\nconst existing: string[] = [];\nfor (const p of paths) {\n  try { await fs.stat(path.resolve(cwd, p)); existing.push(p); } catch { /* skip */ }\n}\nif (existing.length === 0) throw new Error(`all paths missing: ${paths.join(\", \")}`);","typeGuard":null,"tryCatchPattern":"try {\n  await globTool({ path: entries });\n} catch (err) {\n  if (err instanceof ToolError && err.message.startsWith(\"Path not found:\")) {\n    const missing = err.message.slice(\"Path not found: \".length).split(\", \");\n    // verify cwd and retry with corrected paths\n  } else throw err;\n}","preventionTips":["Stat each path (or use a fallback) before multi-path find calls","Run from the correct working directory or use absolute paths","Confirm the project layout/branch actually contains the target directories"],"tags":["path","not-found","filesystem"],"backgroundTag":"path-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}