{"record":{"id":"f57404f82cfbe338","repo":"microsoft/vscode","slug":"unable-to-find-repository-for-working-directory","errorCode":null,"errorMessage":"Unable to find repository for working directory ${worktreePath}","messagePattern":"Unable to find repository for working directory (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts","lineNumber":445,"sourceCode":"\t\tif (worktreeProperties.autoCommit === false) {\n\t\t\tthis.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] Auto-commit is disabled, skipping commit of worktree changes for session ${sessionId}`);\n\n\t\t\t// Delete worktree changes cache\n\t\t\tawait this.setWorktreeProperties(sessionId, {\n\t\t\t\t...worktreeProperties,\n\t\t\t\tchanges: undefined\n\t\t\t});\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst worktreePath = worktreeProperties.worktreePath;\n\n\t\t// Commit all changes in the worktree\n\t\tconst repository = await this.gitCommitMessageService.getRepository(vscode.Uri.file(worktreePath));\n\t\tif (!repository) {\n\t\t\tthis.logService.error(`[ChatSessionWorktreeService][handleRequestCompleted] Unable to find repository for working directory ${worktreePath}`);\n\t\t\tthrow new Error(`Unable to find repository for working directory ${worktreePath}`);\n\t\t}\n\n\t\tif (repository.state.workingTreeChanges.length === 0 && repository.state.indexChanges.length === 0 && repository.state.untrackedChanges.length === 0) {\n\t\t\tthis.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] No changes to commit in working directory ${worktreePath}`);\n\n\t\t\t// Delete worktree changes cache\n\t\t\tawait this.setWorktreeProperties(sessionId, {\n\t\t\t\t...worktreeProperties,\n\t\t\t\tchanges: undefined\n\t\t\t});\n\n\t\t\treturn;\n\t\t}\n\n\t\tlet message: string | undefined;\n\t\ttry {\n\t\t\tthis.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] Generating commit message for working directory ${worktreePath}. Repository state: ${JSON.stringify(repository.state)}`);\n\t\t\tmessage = await this.gitCommitMessageService.generateCommitMessage(repository, CancellationToken.None);","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts#L427-L463","documentation":"Error \"Unable to find repository for working directory ${worktreePath}\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts:445 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"}