vercel/ai · error
Path not found: ${input.path ?? '.'}
Error message
Path not found: ${input.path ?? '.'} What it means
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.
Source
Thrown at packages/harness-cline/src/cline-remote-ops.ts:314
? ['-C', String(input.context)]
: []),
...(input.glob ? ['--include', input.glob] : []),
];
const limit = Math.max(1, input.limit ?? 100);
const result = await runShell({
command: [
`if [ ! -e ${shellQuote(
target,
)} ]; then echo "__CLINE_GREP_NOT_FOUND__"; exit 2; fi`,
`grep ${flags.map(shellQuote).join(' ')} -- ${shellQuote(
pattern,
)} ${shellQuote(target)} 2>/dev/null | head -n ${limit}`,
].join('; '),
});
const output = result.output.trim();
if (output.includes('__CLINE_GREP_NOT_FOUND__')) {
throw new Error(`Path not found: ${input.path ?? '.'}`);
}
return output || 'No matches found';
},
async glob(pattern, inputPath = '.', limit = 1_000) {
const remotePath = resolvePath(inputPath);
const target = await resolveReadableSandboxPath({
remotePath,
inputPath,
});
const result = await runShell({
command: [
`if [ ! -e ${shellQuote(
target,
)} ]; then echo "__CLINE_FIND_NOT_FOUND__"; exit 2; fi`,
`if [ -d ${shellQuote(target)} ]; then find ${shellQuote(
target,
)} -type f -print; else printf '%s\\n' ${shellQuote(target)}; fi`,View on GitHub (pinned to 69428b1f8b)
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.
Example fix
// before: searching a nonexistent dir
await ops.grep('TODO', { path: 'source' }); // Path not found: source
// after: verify the dir first
const entries = await ops.ls('.');
if (!entries.includes('src')) throw new Error('no src dir');
await ops.grep('TODO', { path: 'src' }); Defensive patterns
Strategy: validation
Validate before calling
async function assertGrepPath(ops, searchPath = '.') {
const r = await ops.bash(`test -e ${JSON.stringify(searchPath)} && echo ok || echo missing`);
if (!r.output.includes('ok')) throw new Error(`grep target missing: ${searchPath}`);
} Try / catch
try {
return await ops.grep(pattern, { path });
} catch (e) {
if (e instanceof Error && e.message.startsWith('Path not found:')) {
return ops.grep(pattern); // fall back to the session working directory
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- File not found: ${inputPath}
- Text to replace was not found in ${inputPath}
- Not a directory: ${inputPath}
- `Failed to create sandbox work directory ${workDir} (exit ${
- Cannot write harness skill '${skillName}': ${skillDir} alrea
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/01d13347d6d1b590.
Report an issue: GitHub.