microsoft/vscode · error · InvalidPatchFormatError

patchMustStartWithBeginPatch

patchMustStartWithBeginPatch

Error message

Patch must start with *** Begin Patch\n

What it means

Error "Patch must start with *** Begin Patch\n" thrown in microsoft/vscode.

Source

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

		} else if (change.type === ActionType.ADD) {
			writeFn(p, change.newContent ?? '');
		} else if (change.type === ActionType.UPDATE) {
			if (change.movePath) {
				writeFn(change.movePath, change.newContent ?? '');
				removeFn(p);
			} else {
				writeFn(p, change.newContent ?? '');
			}
		}
	}
}

export async function processPatch(
	text: string,
	openFn: (p: string) => Promise<AbstractDocumentWithLanguageId | TextDocument>,
): Promise<Commit> {
	if (!text.startsWith(PATCH_PREFIX)) {
		throw new InvalidPatchFormatError('Patch must start with *** Begin Patch\\n', 'patchMustStartWithBeginPatch');
	}
	const paths = identify_files_needed(text);
	const orig = await load_files(paths, openFn);
	const [patch, _fuzz] = text_to_patch(text, orig);
	return patch_to_commit(patch, orig);
}

View on GitHub (pinned to a94b963a32)

When it happens

Trigger: Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:954 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/fff626ecb29b467c. Report an issue: GitHub.