continuedev/continue · error · ContinueError
MultiEditEditsArrayRequired
MultiEditEditsArrayRequired
Error message
invalid multi-edit args
What it means
Thrown by validateMultiEdit when the multi-edit arguments are not a non-null object containing an 'edits' property. This is the outermost shape check before any edit is inspected individually, guarding against completely malformed input.
Source
Thrown at core/edit/searchAndReplace/multiEditValidation.ts:15
import { EditOperation } from "../../tools/definitions/multiEdit";
import { ContinueError, ContinueErrorReason } from "../../util/errors";
import { validateSingleEdit } from "./findAndReplaceUtils";
/**
* Validates multi-edit arguments and all edits in a single pass
* @param args - The arguments object containing the edits array
* @returns Validated edits array
* @throws ContinueError if validation fails
*/
export function validateMultiEdit(args: unknown): {
edits: EditOperation[];
} {
if (typeof args !== "object" || !args || !("edits" in args)) {
throw new ContinueError(
ContinueErrorReason.MultiEditEditsArrayRequired,
"invalid multi-edit args",
);
}
// Validate that edits is a non-empty array
if (!Array.isArray(args.edits)) {
throw new ContinueError(
ContinueErrorReason.MultiEditEditsArrayRequired,
"edits array is required",
);
}
const { edits } = args;
if (edits.length === 0) {
throw new ContinueError(
ContinueErrorReason.MultiEditEditsArrayEmpty,
"edits array must contain at least one edit",View on GitHub (pinned to 5522c6f44c)
Solutions
- Wrap the array: call with { edits: [...] }
- Check the key name is exactly 'edits' (plural)
- If building the payload dynamically, assert Object.prototype.hasOwnProperty.call(args, 'edits') first
Example fix
// before
await multiEdit([{ old_string: "a", new_string: "b" }]);
// after
await multiEdit({ edits: [{ old_string: "a", new_string: "b" }] }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof args !== 'object' || args === null || !('edits' in args)) throw new TypeError('expected { edits: [...] }'); Type guard
const isMultiEditArgs = (a: unknown): a is { edits: unknown[] } => typeof a === 'object' && a !== null && Array.isArray((a as any).edits); Try / catch
catch (e) { if (e.message.includes('invalid multi-edit args')) fixPayloadShape(); else throw e; } Prevention
- Always wrap the array in { edits: [...] }
- Type the tool input as { edits: Edit[] }
- Add a JSON-schema 'required: [edits]' to tool definitions
When it happens
Trigger: Calling multi-edit with null, undefined, a string, an array, or an object without an 'edits' key, e.g. passing the edits array directly instead of wrapping it in { edits: [...] }.
Common situations: LLM tool-call JSON that forgot the wrapper object; callers spreading the wrong variable; passing { edit: [...] } (singular) by typo.
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
- MultiEditEditsArrayEmpty
- Table name must be in format schema.table_name, got ${tableN
- Only rule files can be deleted
- FindAndReplaceMissingOldString
- FindAndReplaceMissingNewString
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/c8cd7b76c7e030f8.
Report an issue: GitHub.