{"record":{"id":"3e7d63a7fd9d9eb5","repo":"stablyai/orca","slug":"ssh-connection-is-reconnecting-please-try-again","errorCode":null,"errorMessage":"SSH connection is reconnecting — please try again in a moment","messagePattern":"SSH connection is reconnecting — please try again in a moment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/ipc/filesystem-import-ssh.ts","lineNumber":37,"sourceCode":"  sourcePaths: string[],\n  destDir: string,\n  connectionId: string,\n  options?: { ensureDir?: boolean; assertCurrent?: () => void }\n): Promise<{ results: ImportItemResult[] }> {\n  if (sourcePaths.length === 0) {\n    return { results: [] }\n  }\n\n  const connManager = getSshConnectionManager()\n  const conn = connManager?.getConnection(connectionId)\n  if (!conn) {\n    throw new Error(`No SSH connection for \"${connectionId}\"`)\n  }\n\n  const state = conn.getState()\n  if (state.status !== 'connected') {\n    if (state.status === 'reconnecting') {\n      throw new Error('SSH connection is reconnecting — please try again in a moment')\n    }\n    throw new Error('SSH connection is not active — please reconnect and try again')\n  }\n\n  const provider = requireSshFilesystemProvider(connectionId)\n\n  if (options?.ensureDir) {\n    // Why: terminal-drop staging needs `${worktree}/.orca/drops` to exist\n    // before the first upload. .orca/ is reserved as Orca-owned remote state;\n    // see docs/terminal-drop-ssh.md.\n    await ensureDropStagingDir(provider, destDir, options.assertCurrent)\n  }\n\n  const results: ImportItemResult[] = []\n  const reservedNames = new Set<string>()\n  if (!provider.openFileUploadSession) {\n    throw new Error('Remote file upload is unavailable. Reconnect the SSH target and retry.')\n  }","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/filesystem-import-ssh.ts#L19-L55","documentation":"Thrown by importExternalPathsSsh() when the connection for connectionId exists but conn.getState().status === 'reconnecting'. The connection object is present and actively trying to re-establish, so the import is rejected as transient rather than failed. The message asks the caller to retry shortly.","triggerScenarios":"The SSH transport dropped and the connection manager is mid-reconnect (status 'reconnecting') at the instant importExternalPathsSsh reads conn.getState(). This commonly happens during network blips or SSH server-side keepalive resets.","commonSituations":"Network interruption on the SSH link; server-side idle timeout triggered a reconnect; a hub/relay handoff is in progress; the user clicked import immediately after a disconnect visible in the UI.","solutions":["Wait briefly and retry the import — the reconnect typically completes within seconds.","If it persists, manually click Reconnect on the SSH target, then retry.","Surface the 'reconnecting' status in the UI so the user waits rather than retrying in a tight loop."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Check state before importing; if reconnecting, wait briefly\nimport { getSshConnectionManager } from './ssh'\nfunction connectionStatus(connectionId: string): string | undefined {\n  return getSshConnectionManager()?.getConnection(connectionId)?.getState().status\n}","typeGuard":null,"tryCatchPattern":"async function importWithReconnectRetry(sources, dest, connId, opts) {\n  try {\n    return await importExternalPathsSsh(sources, dest, connId, opts)\n  } catch (e) {\n    if (e instanceof Error && /reconnecting/i.test(e.message)) {\n      await new Promise(r => setTimeout(r, 1500))\n      return importExternalPathsSsh(sources, dest, connId, opts)\n    }\n    throw e\n  }\n}","preventionTips":["Surface 'reconnecting' status in the UI so the user waits instead of hammering retry.","Retry once after a short delay when the status is 'reconnecting'.","Do not treat reconnecting as a hard failure in error reporting."],"tags":["ssh","connection","transient","retry","upload"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}