{"record":{"id":"83106b47821192b9","repo":"stablyai/orca","slug":"ssh-filesystem-provider-lstat-unavailable","errorCode":null,"errorMessage":"SSH filesystem provider lstat unavailable","messagePattern":"SSH filesystem provider lstat unavailable","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/worktrees.ts","lineNumber":2462,"sourceCode":"            worktreePath,\n            registeredWorktrees\n          )\n          if (!registeredWorktree) {\n            const fsProvider = repo.connectionId\n              ? getSshFilesystemProvider(repo.connectionId)\n              : null\n            let canCleanOrphanedDirectory = false\n            if (\n              canCleanupUnregisteredOrcaWorktreeDirectory({\n                meta: removedMeta\n              })\n            ) {\n              if (repo.connectionId) {\n                if (!fsProvider) {\n                  throw new Error('SSH filesystem provider unavailable')\n                }\n                if (!fsProvider.lstat) {\n                  throw new Error('SSH filesystem provider lstat unavailable')\n                }\n                canCleanOrphanedDirectory = await canSafelyRemoveOrphanedWorktreeDirectory(\n                  worktreePath,\n                  repo.path,\n                  (path) => fsProvider.lstat!(path),\n                  (path) => fsProvider.readFile(path)\n                )\n              } else {\n                const access = getLocalWorktreePathAccess(localWorktreeGitOptions)\n                canCleanOrphanedDirectory =\n                  !isDangerousWorktreeRemovalPath(worktreePath, repo.path) &&\n                  (await canSafelyRemoveOrphanedWorktreeDirectory(\n                    toLocalWorktreeRuntimePath(worktreePath, localWorktreeGitOptions),\n                    toLocalWorktreeRuntimePath(repo.path, localWorktreeGitOptions),\n                    access.statPath,\n                    access.readPath\n                  ))\n              }","sourceCodeStart":2444,"sourceCodeEnd":2480,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/worktrees.ts#L2444-L2480","documentation":"Thrown immediately after the SSH filesystem provider availability check when the provider exists but its lstat method is missing. canSafelyRemoveOrphanedWorktreeDirectory needs lstat (and readFile) to validate the orphan directory before deletion; a provider without lstat cannot satisfy the safety check.","triggerScenarios":"An SSH filesystem provider implementation is registered for the connection but does not implement lstat (older/partial provider), and a remove hits the SSH orphaned-directory cleanup path.","commonSituations":"Provider version skew between client and host — an older SSH filesystem relay that predates the lstat capability, or a custom provider missing the method.","solutions":["Update the SSH host/relay to a filesystem provider version that implements lstat.","Reconnect to re-negotiate provider capabilities after upgrading the remote side.","If lstat can't be provided, clear the orphaned directory manually on the host and retry removal (it will then take the already-removed path)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const caps = await invoke('ssh:filesystemProviderCapabilities', repo.connectionId)\nif (!caps?.lstat) {\n  throw new Error('SSH filesystem provider lacks lstat; upgrade the host/relay')\n}","typeGuard":"function hasLstat(provider: unknown): provider is { lstat: (p: string) => Promise<unknown> } {\n  return !!provider && typeof (provider as any).lstat === 'function'\n}","tryCatchPattern":null,"preventionTips":["Upgrade the SSH host/relay to a filesystem provider version that implements lstat.","Re-negotiate capabilities after reconnecting.","If lstat is unavailable, clear orphaned directories manually on the host."],"tags":["ssh","worktree-remove","provider-capability","orphan-cleanup"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}