microsoft/vscode · error · DiffError

File not found: ${p}

Error message

File not found: ${p}

What it means

Error "File not found: ${p}" thrown in microsoft/vscode.

Source

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

	return commit;
}

// -----------------------------------------------------------------------------
// Filesystem helpers for Node environment
// -----------------------------------------------------------------------------

export async function load_files(
	paths: Array<string>,
	openFn: (p: string) => Promise<AbstractDocumentWithLanguageId | TextDocument>,
): Promise<Record<string, AbstractDocumentWithLanguageId | TextDocument>> {
	const orig: Record<string, AbstractDocumentWithLanguageId | TextDocument> = {};
	for (const p of paths) {
		try {
			orig[p] = await openFn(p);
		} catch {
			// Convert any file read error into a DiffError so that callers
			// consistently receive DiffError for patch-related failures.
			throw new DiffError(`File not found: ${p}`);
		}
	}
	return orig;
}

export function apply_commit(
	commit: Commit,
	writeFn: (p: string, c: string) => void,
	removeFn: (p: string) => void,
): void {
	for (const [p, change] of Object.entries(commit.changes)) {
		if (change.type === ActionType.DELETE) {
			removeFn(p);
		} else if (change.type === ActionType.ADD) {
			writeFn(p, change.newContent ?? '');
		} else if (change.type === ActionType.UPDATE) {
			if (change.movePath) {
				writeFn(change.movePath, change.newContent ?? '');

View on GitHub (pinned to a94b963a32)

When it happens

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