{"record":{"id":"4f47cfc14e550262","repo":"microsoft/vscode","slug":"path-origindex-origindex-chunk-origindex","errorCode":null,"errorMessage":"${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.origIndex}","messagePattern":"(.+?): origIndex (.+?) > chunk\\.origIndex (.+?)","errorType":"exception","errorClass":"DiffError","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/tools/node/applyPatch/parser.ts","lineNumber":857,"sourceCode":"function _get_updated_file(\n\ttext: string,\n\taction: PatchAction,\n\tpath: string,\n): string {\n\tif (action.type !== ActionType.UPDATE) {\n\t\tthrow new Error('Expected UPDATE action');\n\t}\n\tconst origLines = text.split('\\n');\n\tconst destLines: Array<string> = [];\n\tlet origIndex = 0;\n\tfor (const chunk of action.chunks) {\n\t\tif (chunk.origIndex > origLines.length) {\n\t\t\tthrow new DiffError(\n\t\t\t\t`${path}: chunk.origIndex ${chunk.origIndex} > len(lines) ${origLines.length}`,\n\t\t\t);\n\t\t}\n\t\tif (origIndex > chunk.origIndex) {\n\t\t\tthrow new DiffError(\n\t\t\t\t`${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.origIndex}`,\n\t\t\t);\n\t\t}\n\t\tdestLines.push(...origLines.slice(origIndex, chunk.origIndex));\n\t\tconst delta = chunk.origIndex - origIndex;\n\t\torigIndex += delta;\n\n\t\t// inserted lines\n\t\tif (chunk.insLines.length) {\n\t\t\tfor (const l of chunk.insLines) {\n\t\t\t\tdestLines.push(l);\n\t\t\t}\n\t\t}\n\t\torigIndex += chunk.delLines.length;\n\t}\n\tdestLines.push(...origLines.slice(origIndex));\n\treturn destLines.join('\\n');\n}","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/tools/node/applyPatch/parser.ts#L839-L875","documentation":"Error \"${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.origIndex}\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:857 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"a94b963a32aa9749d69504576791fa29700ae46d","analyzedAt":"2026-08-12T01:08:56.794Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}