microsoft/vscode · error · DiffError

${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.or

Error message

${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.origIndex}

What it means

Error "${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.origIndex}" thrown in microsoft/vscode.

Source

Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:857

function _get_updated_file(
	text: string,
	action: PatchAction,
	path: string,
): string {
	if (action.type !== ActionType.UPDATE) {
		throw new Error('Expected UPDATE action');
	}
	const origLines = text.split('\n');
	const destLines: Array<string> = [];
	let origIndex = 0;
	for (const chunk of action.chunks) {
		if (chunk.origIndex > origLines.length) {
			throw new DiffError(
				`${path}: chunk.origIndex ${chunk.origIndex} > len(lines) ${origLines.length}`,
			);
		}
		if (origIndex > chunk.origIndex) {
			throw new DiffError(
				`${path}: origIndex ${origIndex} > chunk.origIndex ${chunk.origIndex}`,
			);
		}
		destLines.push(...origLines.slice(origIndex, chunk.origIndex));
		const delta = chunk.origIndex - origIndex;
		origIndex += delta;

		// inserted lines
		if (chunk.insLines.length) {
			for (const l of chunk.insLines) {
				destLines.push(l);
			}
		}
		origIndex += chunk.delLines.length;
	}
	destLines.push(...origLines.slice(origIndex));
	return destLines.join('\n');
}

View on GitHub (pinned to a94b963a32)

When it happens

Trigger: Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:857 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/vscode@a94b963a32 (2026-08-12). Data as JSON: /api/errors/4f47cfc14e550262. Report an issue: GitHub.