microsoft/vscode · error · Error

Open a file to add code.

Error message

Open a file to add code.

What it means

Error "Open a file to add code." thrown in microsoft/vscode.

Source

Thrown at extensions/copilot/src/extension/intents/node/editCodeIntent.ts:190

		({ conversation, request } = await this._handleCodesearch(conversation, request, location, stream, token, documentContext, chatTelemetry));
		return this.instantiationService.createInstance(EditIntentRequestHandler, this, conversation, request, stream, token, documentContext, location, chatTelemetry, this.getIntentHandlerOptions(request), yieldRequested).getResult();
	}

	protected getIntentHandlerOptions(_request: vscode.ChatRequest): IDefaultIntentRequestHandlerOptions | undefined {
		return undefined;
	}

	async invoke(invocationContext: IIntentInvocationContext) {
		const { location, documentContext, request } = invocationContext;
		const endpoint = await this.endpointProvider.getChatEndpoint(request);

		if (location === ChatLocation.Panel || location === ChatLocation.Notebook) {
			return this.instantiationService.createInstance(this.intentOptions.intentInvocation, this, location, endpoint, request, this.intentOptions);
		}

		if (!documentContext) {
			throw new Error('Open a file to add code.');
		}
		return this.instantiationService.createInstance(GenericInlineIntentInvocation, this, location, endpoint, documentContext, EditStrategy.FallbackToReplaceRange);
	}
}

class EditIntentRequestHandler {

	constructor(
		private readonly intent: EditCodeIntent,
		private readonly conversation: Conversation,
		private readonly request: vscode.ChatRequest,
		private readonly stream: vscode.ChatResponseStream,
		private readonly token: vscode.CancellationToken,
		private readonly documentContext: IDocumentContext | undefined,
		private readonly location: ChatLocation,
		private readonly chatTelemetry: ChatTelemetryBuilder,
		private readonly handlerOptions: IDefaultIntentRequestHandlerOptions | undefined,
		private readonly yieldRequested: () => boolean,

View on GitHub (pinned to a94b963a32)

When it happens

Trigger: Thrown at extensions/copilot/src/extension/intents/node/editCodeIntent.ts:190 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/c17c9dd5af848594. Report an issue: GitHub.