fix(session): prevent listing non-existent worktree directory

This commit is contained in:
Bohdan Triapitsyn
2025-12-26 01:37:37 +02:00
parent 3c8cc3a93e
commit 91a4e7d049
+8 -1
View File
@@ -273,7 +273,14 @@ export const useSessionStore = create<SessionStore>()(
const worktreeRoot = `${normalizedProject}/${WORKTREE_ROOT}`;
try {
const candidates = new Set<string>();
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)