{"record":{"id":"181742073305df5d","repo":"continuedev/continue","slug":"multiediteditsarrayempty","errorCode":"MultiEditEditsArrayEmpty","errorMessage":"edits array must contain at least one edit","messagePattern":"edits array must contain at least one edit","errorType":"validation","errorClass":"ContinueError","httpStatus":null,"severity":"error","filePath":"core/edit/searchAndReplace/multiEditValidation.ts","lineNumber":31,"sourceCode":"} {\n  if (typeof args !== \"object\" || !args || !(\"edits\" in args)) {\n    throw new ContinueError(\n      ContinueErrorReason.MultiEditEditsArrayRequired,\n      \"invalid multi-edit args\",\n    );\n  }\n\n  // Validate that edits is a non-empty array\n  if (!Array.isArray(args.edits)) {\n    throw new ContinueError(\n      ContinueErrorReason.MultiEditEditsArrayRequired,\n      \"edits array is required\",\n    );\n  }\n  const { edits } = args;\n\n  if (edits.length === 0) {\n    throw new ContinueError(\n      ContinueErrorReason.MultiEditEditsArrayEmpty,\n      \"edits array must contain at least one edit\",\n    );\n  }\n\n  // Validate each individual edit\n  for (let i = 0; i < edits.length; i++) {\n    const edit = edits[i];\n\n    // Use existing single edit validation\n    validateSingleEdit(edit.old_string, edit.new_string, edit.replace_all, i);\n\n    // Only the first edit can have empty old_string (for insertion at beginning)\n    if (i > 0 && edit.old_string === \"\") {\n      throw new ContinueError(\n        ContinueErrorReason.FindAndReplaceNonFirstEmptyOldString,\n        `Edit at index ${i}: old_string cannot be empty. Only the first edit can have an empty old_string for insertion at the beginning of the file.`,\n      );","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/edit/searchAndReplace/multiEditValidation.ts#L13-L49","documentation":"Thrown by validateMultiEdit when the edits array exists but has zero elements. An empty multi-edit is rejected as a likely caller mistake since it would be a guaranteed no-op.","triggerScenarios":"Calling multi-edit with { edits: [] }, often because a filter/map chain upstream produced an empty array.","commonSituations":"Pipeline code that builds edits conditionally and ends up with none; LLM agents emitting an empty edits list when they decide no change is needed.","solutions":["Skip the multi-edit call entirely when the computed edits array is empty","Guard with a conditional: if (edits.length > 0) await multiEdit({ edits })","If using an LLM tool schema, tell the model to omit the call rather than send empty edits"],"exampleFix":"// before\nawait multiEdit({ edits: edits.filter(wanted) }); // filter may yield []\n// after\nconst wantedEdits = edits.filter(wanted);\nif (wantedEdits.length > 0) await multiEdit({ edits: wantedEdits });","handlingStrategy":"validation","validationCode":"if (!Array.isArray(edits) || edits.length === 0) return; // skip call","typeGuard":"const hasEdits = (e: unknown[]): e is [unknown, ...unknown[]] => e.length > 0;","tryCatchPattern":null,"preventionTips":["Guard length before calling","Return early from pipelines whose filters may empty the array","Tell LLM agents not to call with zero edits"],"tags":["multi-edit","validation","empty-array"],"backgroundTag":"empty-input-array","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}