{"record":{"id":"aa59540e298940b5","repo":"microsoft/vscode","slug":"path-chunk-origindex-chunk-origindex-len","errorCode":null,"errorMessage":"${path}: chunk.origIndex ${chunk.origIndex} > len(lines) ${origLines.length}","messagePattern":"(.+?): chunk\\.origIndex (.+?) > len\\(lines\\) (.+?)","errorType":"exception","errorClass":"DiffError","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/tools/node/applyPatch/parser.ts","lineNumber":852,"sourceCode":"\t\t}\n\t}\n\treturn [...result];\n}\n\nfunction _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}","sourceCodeStart":834,"sourceCodeEnd":870,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/tools/node/applyPatch/parser.ts#L834-L870","documentation":"Error \"${path}: chunk.origIndex ${chunk.origIndex} > len(lines) ${origLines.length}\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:852 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"}