{"record":{"id":"d41ac0431a1ac305","repo":"microsoft/vscode","slug":"no-active-repository-found-to-delete-worktree-d41ac0","errorCode":null,"errorMessage":"No active repository found to delete worktree.","messagePattern":"No active repository found to delete worktree\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts","lineNumber":2225,"sourceCode":"\t\t\tmetadataStore,\n\t\t\tcopilotCliWorkspaceSession,\n\t\t);\n\t\treturn siblings.length > 0;\n\t}\n\tasync function deleteSessionById(sessionId: string, options?: { keepWorktree?: boolean; sessionLabel?: string }): Promise<void> {\n\t\tconst worktree = await copilotCLIWorktreeManagerService.getWorktreeProperties(sessionId);\n\t\tconst worktreePath = await copilotCLIWorktreeManagerService.getWorktreePath(sessionId);\n\n\t\tawait copilotCLISessionService.deleteSession(sessionId);\n\t\tawait copilotCliWorkspaceSession.deleteTrackedWorkspaceFolder(sessionId);\n\n\t\tif (worktreePath && !options?.keepWorktree) {\n\t\t\tconst worktreeExists = await fileSystemService.stat(worktreePath).then(() => true, () => false);\n\t\t\tif (worktreeExists) {\n\t\t\t\ttry {\n\t\t\t\t\tconst repository = worktree ? await gitService.getRepository(vscode.Uri.file(worktree.repositoryPath), true) : undefined;\n\t\t\t\t\tif (!repository) {\n\t\t\t\t\t\tthrow new Error(l10n.t('No active repository found to delete worktree.'));\n\t\t\t\t\t}\n\t\t\t\t\tawait gitService.deleteWorktree(repository.rootUri, worktreePath.fsPath, { label: options?.sessionLabel });\n\t\t\t\t} catch (error) {\n\t\t\t\t\tvscode.window.showErrorMessage(l10n.t('Failed to delete worktree: {0}', error instanceof Error ? error.message : String(error)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tdisposableStore.add(vscode.commands.registerCommand('github.copilot.cli.sessions.delete', async (sessionItem?: vscode.ChatSessionItem) => {\n\t\tif (sessionItem?.resource) {\n\t\t\tconst id = SessionIdForCLI.parse(sessionItem.resource);\n\t\t\tconst sessionId = copilotcliSessionItemProvider.untitledSessionIdMapping.get(id) ?? id;\n\t\t\tconst worktreePath = await copilotCLIWorktreeManagerService.getWorktreePath(sessionId);\n\t\t\tconst keepWorktree = !!worktreePath && await shouldKeepWorktreeForOtherSessions(sessionId, worktreePath);\n\n\t\t\tconst confirmMessage = (worktreePath && !keepWorktree)\n\t\t\t\t? l10n.t('Are you sure you want to delete the session and its associated worktree?')\n\t\t\t\t: l10n.t('Are you sure you want to delete the session?');","sourceCodeStart":2207,"sourceCodeEnd":2243,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts#L2207-L2243","documentation":"Error \"No active repository found to delete worktree.\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts:2225 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"a94b963a32aa9749d69504576791fa29700ae46d","analyzedAt":"2026-08-12T01:08:56.794Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}