{"record":{"id":"c74328d070481052","repo":"continuedev/continue","slug":"filenotfound","errorCode":"FileNotFound","errorMessage":"File ${filepath} does not exist","messagePattern":"File (.+?) does not exist","errorType":"validation","errorClass":"ContinueError","httpStatus":null,"severity":"error","filePath":"core/edit/searchAndReplace/validateArgs.ts","lineNumber":17,"sourceCode":"import { IDE } from \"../..\";\nimport { ContinueError, ContinueErrorReason } from \"../../util/errors\";\nimport { resolveRelativePathInDir } from \"../../util/ideUtils\";\n\nexport async function validateSearchAndReplaceFilepath(\n  filepath: unknown,\n  ide: IDE,\n) {\n  if (!filepath || typeof filepath !== \"string\") {\n    throw new ContinueError(\n      ContinueErrorReason.FindAndReplaceMissingFilepath,\n      \"filepath (string) is required\",\n    );\n  }\n  const resolvedFilepath = await resolveRelativePathInDir(filepath, ide);\n  if (!resolvedFilepath) {\n    throw new ContinueError(\n      ContinueErrorReason.FileNotFound,\n      `File ${filepath} does not exist`,\n    );\n  }\n  return resolvedFilepath;\n}\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/edit/searchAndReplace/validateArgs.ts#L1-L24","documentation":"Thrown by validateSearchAndReplaceFilepath when the filepath cannot be resolved to an existing file (resolveRelativePathInDir returned nothing). The library resolves relative paths against workspace directories before touching the file, and a failed resolution means the file does not exist there.","triggerScenarios":"Passing a relative path that doesn't exist in any workspace directory, a typo'd absolute path, or a path to a file that was deleted/renamed.","commonSituations":"Hardcoded relative paths like \"src/index.ts\" that break when the working directory changes; stale paths after a refactor or rename; files not yet created (use create-file instead).","solutions":["Use an absolute path, or verify the relative path resolves from the intended workspace directory","Check the file exists (fs.existsSync) before calling when the path is dynamic","If creating a new file, use the file-creation API rather than find/replace"],"exampleFix":"// before\nawait findAndReplace({ filepath: \"src/util.ts\", ... }); // cwd-dependent\n// after\nawait findAndReplace({ filepath: path.resolve(root, \"src/util.ts\"), ... });","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs'; if (!existsSync(filepath)) throw new Error(`no such file: ${filepath}`);","typeGuard":"const isExistingFile = async (fp: string) => { try { await fs.stat(fp); return true; } catch { return false; } };","tryCatchPattern":"catch (e) { if (e.message.includes('does not exist')) { resolveAbsolutePathAndRetry(); } else throw e; }","preventionTips":["Prefer absolute paths","Stat the file before editing dynamic paths","Use create-file APIs for new files"],"tags":["filepath","file-not-found","path-resolution"],"backgroundTag":"file-not-found","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}