continuedev/continue · error · ContinueError

FindAndReplaceInvalidReplaceAll

FindAndReplaceInvalidReplaceAll

Error message

${context}replace_all must be a valid boolean

What it means

Thrown when the optional replace_all field of a find/replace edit is present but is not a boolean. The validator only checks replace_all when it is defined; any other type (string "true", number 1, null treated as an object) is rejected because the downstream replace logic branches on a strict boolean.

Source

Thrown at core/edit/searchAndReplace/findAndReplaceUtils.ts:36

    throw new ContinueError(
      ContinueErrorReason.FindAndReplaceMissingOldString,
      `${context}string old_string is required`,
    );
  }
  if (newString === undefined || typeof newString !== "string") {
    throw new ContinueError(
      ContinueErrorReason.FindAndReplaceMissingNewString,
      `${context}string new_string is required`,
    );
  }
  if (oldString === newString) {
    throw new ContinueError(
      ContinueErrorReason.FindAndReplaceIdenticalOldAndNewStrings,
      `${context}old_string and new_string must be different`,
    );
  }
  if (replaceAll !== undefined && typeof replaceAll !== "boolean") {
    throw new ContinueError(
      ContinueErrorReason.FindAndReplaceInvalidReplaceAll,
      `${context}replace_all must be a valid boolean`,
    );
  }
  return { oldString, newString, replaceAll };
}

export function trimEmptyLines({
  lines,
  fromEnd,
}: {
  lines: string[];
  fromEnd: boolean;
}): string[] {
  lines = fromEnd ? lines.slice().reverse() : lines.slice();
  const newLines: string[] = [];
  let shouldContinueRemoving = true;
  for (let index = 0; index < lines.length; index++) {

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Pass a real boolean: replace_all: true or replace_all: false
  2. Omit replace_all entirely if you don't need multi-replacement semantics
  3. If the value comes from an external source, coerce it before calling: replace_all: String(val) === "true"

Example fix

// before
edit({ old_string: "a", new_string: "b", replace_all: "true" });
// after
edit({ old_string: "a", new_string: "b", replace_all: true });
Defensive patterns

Strategy: type-guard

Validate before calling

if (edit.replace_all !== undefined && typeof edit.replace_all !== 'boolean') edit.replace_all = Boolean(edit.replace_all);

Type guard

const hasValidReplaceAll = (e: any): e is { replace_all?: boolean } => e.replace_all === undefined || typeof e.replace_all === 'boolean';

Try / catch

catch (e) { if (e.message.includes('replace_all')) { edit.replace_all = Boolean(edit.replace_all); retry(); } else throw e; }

Prevention

When it happens

Trigger: Passing replace_all: "true", replace_all: 1, or replace_all: null in a find_and_replace or multi-edit edit object; JSON payloads where booleans were serialized as strings.

Common situations: LLM tool calls that emit replace_all as a JSON string; config files or HTTP APIs marshalling booleans across language boundaries (e.g. Python clients sending "true").

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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