microsoft/vscode · error · Error
Unable to find repository for working directory ${worktreePa
Error message
Unable to find repository for working directory ${worktreePath} What it means
Error "Unable to find repository for working directory ${worktreePath}" thrown in microsoft/vscode.
Source
Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts:445
if (worktreeProperties.autoCommit === false) {
this.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] Auto-commit is disabled, skipping commit of worktree changes for session ${sessionId}`);
// Delete worktree changes cache
await this.setWorktreeProperties(sessionId, {
...worktreeProperties,
changes: undefined
});
return;
}
const worktreePath = worktreeProperties.worktreePath;
// Commit all changes in the worktree
const repository = await this.gitCommitMessageService.getRepository(vscode.Uri.file(worktreePath));
if (!repository) {
this.logService.error(`[ChatSessionWorktreeService][handleRequestCompleted] Unable to find repository for working directory ${worktreePath}`);
throw new Error(`Unable to find repository for working directory ${worktreePath}`);
}
if (repository.state.workingTreeChanges.length === 0 && repository.state.indexChanges.length === 0 && repository.state.untrackedChanges.length === 0) {
this.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] No changes to commit in working directory ${worktreePath}`);
// Delete worktree changes cache
await this.setWorktreeProperties(sessionId, {
...worktreeProperties,
changes: undefined
});
return;
}
let message: string | undefined;
try {
this.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] Generating commit message for working directory ${worktreePath}. Repository state: ${JSON.stringify(repository.state)}`);
message = await this.gitCommitMessageService.generateCommitMessage(repository, CancellationToken.None);View on GitHub (pinned to a94b963a32)
When it happens
Trigger: Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts:445 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/f57404f82cfbe338.
Report an issue: GitHub.