{"record":{"id":"292233a88e26c7c4","repo":"continuedev/continue","slug":"findandreplaceinvalidreplaceall","errorCode":"FindAndReplaceInvalidReplaceAll","errorMessage":"${context}replace_all must be a valid boolean","messagePattern":"(.+?)replace_all must be a valid boolean","errorType":"validation","errorClass":"ContinueError","httpStatus":null,"severity":"error","filePath":"core/edit/searchAndReplace/findAndReplaceUtils.ts","lineNumber":36,"sourceCode":"    throw new ContinueError(\n      ContinueErrorReason.FindAndReplaceMissingOldString,\n      `${context}string old_string is required`,\n    );\n  }\n  if (newString === undefined || typeof newString !== \"string\") {\n    throw new ContinueError(\n      ContinueErrorReason.FindAndReplaceMissingNewString,\n      `${context}string new_string is required`,\n    );\n  }\n  if (oldString === newString) {\n    throw new ContinueError(\n      ContinueErrorReason.FindAndReplaceIdenticalOldAndNewStrings,\n      `${context}old_string and new_string must be different`,\n    );\n  }\n  if (replaceAll !== undefined && typeof replaceAll !== \"boolean\") {\n    throw new ContinueError(\n      ContinueErrorReason.FindAndReplaceInvalidReplaceAll,\n      `${context}replace_all must be a valid boolean`,\n    );\n  }\n  return { oldString, newString, replaceAll };\n}\n\nexport function trimEmptyLines({\n  lines,\n  fromEnd,\n}: {\n  lines: string[];\n  fromEnd: boolean;\n}): string[] {\n  lines = fromEnd ? lines.slice().reverse() : lines.slice();\n  const newLines: string[] = [];\n  let shouldContinueRemoving = true;\n  for (let index = 0; index < lines.length; index++) {","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/edit/searchAndReplace/findAndReplaceUtils.ts#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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\").","solutions":["Pass a real boolean: replace_all: true or replace_all: false","Omit replace_all entirely if you don't need multi-replacement semantics","If the value comes from an external source, coerce it before calling: replace_all: String(val) === \"true\""],"exampleFix":"// before\nedit({ old_string: \"a\", new_string: \"b\", replace_all: \"true\" });\n// after\nedit({ old_string: \"a\", new_string: \"b\", replace_all: true });","handlingStrategy":"type-guard","validationCode":"if (edit.replace_all !== undefined && typeof edit.replace_all !== 'boolean') edit.replace_all = Boolean(edit.replace_all);","typeGuard":"const hasValidReplaceAll = (e: any): e is { replace_all?: boolean } => e.replace_all === undefined || typeof e.replace_all === 'boolean';","tryCatchPattern":"catch (e) { if (e.message.includes('replace_all')) { edit.replace_all = Boolean(edit.replace_all); retry(); } else throw e; }","preventionTips":["Coerce booleans at the API boundary","Type your edit payloads as { replace_all?: boolean }","Never serialize booleans as strings in tool JSON"],"tags":["find-and-replace","validation","boolean","type-mismatch"],"backgroundTag":"schema-validation-failed","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}