microsoft/vscode · error · Error

Failed to get session item for forked session ${forkedSessio

Error message

Failed to get session item for forked session ${forkedSessionId}

What it means

Error "Failed to get session item for forked session ${forkedSessionId}" thrown in microsoft/vscode.

Source

Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts:223

					// Given we're done generating a title, refresh the contents of this session so that the new title is picked up.
					if (this.controller.items.get(resource)) {
						this.refreshSession({ reason: 'update', sessionId }).catch(() => { /* expected if session was deleted */ });
					}
				})
				.catch(ex => this.logService.error(ex, 'Failed to generate custom session title'));

			controller.items.add(session);
			this.newSessions.set(resource, session);
			return session;
		};
		if (this.configurationService.getConfig(ConfigKey.Advanced.CLIForkSessionsEnabled)) {
			controller.forkHandler = async (sessionResource: Uri, request: ChatRequestTurn2 | undefined, token: vscode.CancellationToken) => {
				const sessionId = SessionIdForCLI.parse(sessionResource);
				const folderInfo = await this.folderRepositoryManager.getFolderRepository(sessionId, undefined, token);
				const forkedSessionId = await this.sessionService.forkSession({ sessionId, requestId: request?.id, workspace: folderInfo }, token);
				const item = await this.sessionService.getSessionItem(forkedSessionId, token);
				if (!item) {
					throw new Error(`Failed to get session item for forked session ${forkedSessionId}`);
				}
				return this.toChatSessionItem(item, undefined, token);
			};
		}
		// Defers the slow `buildChanges` (git diff) call to when the editor renders the item.
		if (this.configurationService.getConfig(ConfigKey.Advanced.CLIChatLazyLoadSessionItem)) {
			controller.resolveChatSessionItem = async (item, token) => {
				const sessionId = SessionIdForCLI.parse(item.resource);
				const session = await this.sessionService.getSessionItem(sessionId, token);
				if (!session || token.isCancellationRequested) {
					return;
				}
				const updatedItem = await this.toChatSessionItem(session, { includeChanges: true }, token);
				controller.items.add(updatedItem);
			};
		}
		this._register(this.sessionService.onDidDeleteSession(async (e) => {
			controller.items.delete(SessionIdForCLI.getResource(e));

View on GitHub (pinned to a94b963a32)

When it happens

Trigger: Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts:223 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/aee6339fadf465e2. Report an issue: GitHub.