{"record":{"id":"01d13347d6d1b590","repo":"vercel/ai","slug":"path-not-found-input-path","errorCode":null,"errorMessage":"Path not found: ${input.path ?? '.'}","messagePattern":"Path not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness-cline/src/cline-remote-ops.ts","lineNumber":314,"sourceCode":"          ? ['-C', String(input.context)]\n          : []),\n        ...(input.glob ? ['--include', input.glob] : []),\n      ];\n      const limit = Math.max(1, input.limit ?? 100);\n      const result = await runShell({\n        command: [\n          `if [ ! -e ${shellQuote(\n            target,\n          )} ]; then echo \"__CLINE_GREP_NOT_FOUND__\"; exit 2; fi`,\n          `grep ${flags.map(shellQuote).join(' ')} -- ${shellQuote(\n            pattern,\n          )} ${shellQuote(target)} 2>/dev/null | head -n ${limit}`,\n        ].join('; '),\n      });\n\n      const output = result.output.trim();\n      if (output.includes('__CLINE_GREP_NOT_FOUND__')) {\n        throw new Error(`Path not found: ${input.path ?? '.'}`);\n      }\n      return output || 'No matches found';\n    },\n\n    async glob(pattern, inputPath = '.', limit = 1_000) {\n      const remotePath = resolvePath(inputPath);\n      const target = await resolveReadableSandboxPath({\n        remotePath,\n        inputPath,\n      });\n      const result = await runShell({\n        command: [\n          `if [ ! -e ${shellQuote(\n            target,\n          )} ]; then echo \"__CLINE_FIND_NOT_FOUND__\"; exit 2; fi`,\n          `if [ -d ${shellQuote(target)} ]; then find ${shellQuote(\n            target,\n          )} -type f -print; else printf '%s\\\\n' ${shellQuote(target)}; fi`,","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-cline/src/cline-remote-ops.ts#L296-L332","documentation":"Thrown by grep when the search target path does not exist inside the sandbox: the shell probe echoes the __CLINE_GREP_NOT_FOUND__ sentinel (the `[ ! -e target ]` test fails) and the library converts it into 'Path not found' using the caller-supplied input.path (default '.'). Note the default '.' in the message refers to the session working directory.","triggerScenarios":"grep(pattern, { path: 'missing-dir' }) where missing-dir does not exist in the sandbox; grep with a path typo or a path outside the session workDir that normalizes to a nonexistent location; searching after the directory was deleted.","commonSituations":"Agents searching directories they assume exist (e.g. 'src' before checkout); wrong case (Src vs src) on case-sensitive sandbox filesystems; grep on a workDir that was never provisioned; typos in user-supplied search paths.","solutions":["Run ops.ls('.') or ops.bash('pwd; ls') to see the actual sandbox tree before grepping.","Fix the path spelling/casing in the grep input.path option.","Omit input.path to search the session working directory by default.","Create the directory (or check out the code) inside the sandbox before searching."],"exampleFix":"// before: searching a nonexistent dir\nawait ops.grep('TODO', { path: 'source' }); // Path not found: source\n\n// after: verify the dir first\nconst entries = await ops.ls('.');\nif (!entries.includes('src')) throw new Error('no src dir');\nawait ops.grep('TODO', { path: 'src' });","handlingStrategy":"validation","validationCode":"async function assertGrepPath(ops, searchPath = '.') {\n  const r = await ops.bash(`test -e ${JSON.stringify(searchPath)} && echo ok || echo missing`);\n  if (!r.output.includes('ok')) throw new Error(`grep target missing: ${searchPath}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await ops.grep(pattern, { path });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Path not found:')) {\n    return ops.grep(pattern); // fall back to the session working directory\n  }\n  throw e;\n}","preventionTips":["Run ops.ls('.') first to learn the sandbox layout before searching.","Remember sandbox filesystems are case-sensitive (Src ≠ src).","Default to input.path omitted (searches the workDir) unless the dir is confirmed.","Wait for workspace sync/provisioning to finish before searching."],"tags":["grep","filesystem","path-not-found"],"backgroundTag":"path-not-found","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}