microsoft/vscode · error · Error
No active repository found to delete worktree.
Error message
No active repository found to delete worktree.
What it means
Error "No active repository found to delete worktree." thrown in microsoft/vscode.
Source
Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts:1071
metadataStore: IChatSessionMetadataStore,
logService: ILogService
): IDisposable {
const disposableStore = new DisposableStore();
async function deleteSessionById(sessionId: string, options?: { keepWorktree?: boolean; sessionLabel?: string }): Promise<void> {
const worktree = await copilotCLIWorktreeManagerService.getWorktreeProperties(sessionId);
const worktreePath = await copilotCLIWorktreeManagerService.getWorktreePath(sessionId);
await copilotCLISessionService.deleteSession(sessionId);
await copilotCliWorkspaceSession.deleteTrackedWorkspaceFolder(sessionId);
if (worktreePath && !options?.keepWorktree) {
const worktreeExists = await fileSystemService.stat(worktreePath).then(() => true, () => false);
if (worktreeExists) {
try {
const repository = worktree ? await gitService.getRepository(vscode.Uri.file(worktree.repositoryPath), true) : undefined;
if (!repository) {
throw new Error(l10n.t('No active repository found to delete worktree.'));
}
await gitService.deleteWorktree(repository.rootUri, worktreePath.fsPath, { label: options?.sessionLabel });
} catch (error) {
vscode.window.showErrorMessage(l10n.t('Failed to delete worktree: {0}', error instanceof Error ? error.message : String(error)));
}
}
}
await contentProvider.refreshSession({ reason: 'delete', sessionId });
}
/**
* Determine whether the worktree at `worktreePath` is still in use by another
* non-archived, non-sub-session sibling. Used to gate worktree deletion.
*/
async function shouldKeepWorktreeForOtherSessions(sessionId: string, worktreePath: vscode.Uri): Promise<boolean> {
const siblings = await getBlockingSiblingSessionsForFolder(
worktreePath,View on GitHub (pinned to a94b963a32)
When it happens
Trigger: Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts:1071 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/39ae9bee436a1bf0.
Report an issue: GitHub.