From 91a4e7d049985d4f99595bf383eb6c1c2cc09966 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Fri, 26 Dec 2025 01:37:37 +0200 Subject: [PATCH] fix(session): prevent listing non-existent worktree directory --- packages/ui/src/stores/sessionStore.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/stores/sessionStore.ts b/packages/ui/src/stores/sessionStore.ts index 33d9d19c..d9e21c71 100644 --- a/packages/ui/src/stores/sessionStore.ts +++ b/packages/ui/src/stores/sessionStore.ts @@ -273,7 +273,14 @@ export const useSessionStore = create()( const worktreeRoot = `${normalizedProject}/${WORKTREE_ROOT}`; try { const candidates = new Set(); - if (worktreeRoot) { + + // Check if .openchamber directory exists before trying to list it + const projectEntries = await opencodeClient.listLocalDirectory(normalizedProject); + const worktreeDirExists = projectEntries.some( + (entry) => entry.isDirectory && entry.name === WORKTREE_ROOT + ); + + if (worktreeDirExists) { const entries = await opencodeClient.listLocalDirectory(worktreeRoot); entries .filter((entry) => entry.isDirectory)