diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 82b348936c..349034fdcf 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -298,13 +298,13 @@ export default function Sidebar() { dispatch({ type: "DELETE_THREAD", threadId }); - if (!shouldDeleteWorktree || !orphanedWorktreePath) { + if (!shouldDeleteWorktree || !orphanedWorktreePath || !threadProject) { return; } try { await api.git.removeWorktree({ - cwd: threadProject?.cwd ?? orphanedWorktreePath, + cwd: threadProject.cwd, path: orphanedWorktreePath, }); } catch {