continuedev/continue · error · ContinueError
FindAndReplaceMissingFilepath
FindAndReplaceMissingFilepath
Error message
filepath (string) is required
What it means
Thrown by validateSearchAndReplaceFilepath when the filepath argument is missing, empty, or not a string. It is the first check before path resolution, so any non-string filepath fails here rather than deep in file I/O.
Source
Thrown at core/edit/searchAndReplace/validateArgs.ts:10
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
- Ensure filepath is a non-empty string before calling
- If you hold a Uri object, pass uri.path or the documented string form
- Validate required fields up front in your own tool wrapper
Example fix
// before
await findAndReplace({ filepath: uri, ... });
// after
await findAndReplace({ filepath: String(uri.path ?? uri), ... }); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof filepath !== 'string' || filepath.length === 0) throw new TypeError('filepath string required'); Type guard
const isFilepath = (f: unknown): f is string => typeof f === 'string' && f.trim().length > 0;
Prevention
- Destructure with defaults and assert presence
- Pass uri.path for URI objects
- Add required-field checks in tool wrappers
When it happens
Trigger: Calling search/replace tools with filepath: undefined, filepath: null, filepath: 123, or filepath: "" — commonly a destructuring typo or an unset variable.
Common situations: LLM tool calls omitting the filepath field; callers passing a URI object instead of its string path; optional chaining upstream yielding undefined.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Table name must be in format schema.table_name, got ${tableN
- Only rule files can be deleted
- FindAndReplaceMissingOldString
- FindAndReplaceMissingNewString
- FindAndReplaceIdenticalOldAndNewStrings
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/80ac56e9d008dab3.
Report an issue: GitHub.