{"record":{"id":"39ae9bee436a1bf0","repo":"microsoft/vscode","slug":"no-active-repository-found-to-delete-worktree","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/copilotCLIChatSessions.ts","lineNumber":1071,"sourceCode":"\tmetadataStore: IChatSessionMetadataStore,\n\tlogService: ILogService\n): IDisposable {\n\tconst disposableStore = new DisposableStore();\n\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\n\t\tawait contentProvider.refreshSession({ reason: 'delete', sessionId });\n\t}\n\n\t/**\n\t * Determine whether the worktree at `worktreePath` is still in use by another\n\t * non-archived, non-sub-session sibling. Used to gate worktree deletion.\n\t */\n\tasync function shouldKeepWorktreeForOtherSessions(sessionId: string, worktreePath: vscode.Uri): Promise<boolean> {\n\t\tconst siblings = await getBlockingSiblingSessionsForFolder(\n\t\t\tworktreePath,","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts#L1053-L1089","documentation":"Error \"No active repository found to delete worktree.\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts:1071 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"}