continuedev/continue · error · ContinueError

FileNotFound

FileNotFound

Error message

File ${filepath} does not exist

What it means

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.

Source

Thrown at core/edit/searchAndReplace/validateArgs.ts:17

import { IDE } from "../..";
import { ContinueError, ContinueErrorReason } from "../../util/errors";
import { resolveRelativePathInDir } from "../../util/ideUtils";

export async function validateSearchAndReplaceFilepath(
  filepath: unknown,
  ide: IDE,
) {
  if (!filepath || typeof filepath !== "string") {
    throw new ContinueError(
      ContinueErrorReason.FindAndReplaceMissingFilepath,
      "filepath (string) is required",
    );
  }
  const resolvedFilepath = await resolveRelativePathInDir(filepath, ide);
  if (!resolvedFilepath) {
    throw new ContinueError(
      ContinueErrorReason.FileNotFound,
      `File ${filepath} does not exist`,
    );
  }
  return resolvedFilepath;
}

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Use an absolute path, or verify the relative path resolves from the intended workspace directory
  2. Check the file exists (fs.existsSync) before calling when the path is dynamic
  3. If creating a new file, use the file-creation API rather than find/replace

Example fix

// before
await findAndReplace({ filepath: "src/util.ts", ... }); // cwd-dependent
// after
await findAndReplace({ filepath: path.resolve(root, "src/util.ts"), ... });
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs'; if (!existsSync(filepath)) throw new Error(`no such file: ${filepath}`);

Type guard

const isExistingFile = async (fp: string) => { try { await fs.stat(fp); return true; } catch { return false; } };

Try / catch

catch (e) { if (e.message.includes('does not exist')) { resolveAbsolutePathAndRetry(); } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/c74328d070481052. Report an issue: GitHub.