{"record":{"id":"3af0a4be3c78b725","repo":"stablyai/orca","slug":"ssh-connection-is-not-active-please-reconnect-an","errorCode":null,"errorMessage":"SSH connection is not active — please reconnect and try again","messagePattern":"SSH connection is not active — please reconnect and try again","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/filesystem-import-ssh.ts","lineNumber":39,"sourceCode":"  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  }\n  options?.assertCurrent?.()\n  const uploadSession = await provider.openFileUploadSession()","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/filesystem-import-ssh.ts#L21-L57","documentation":"Thrown by importExternalPathsSsh() when the connection exists, is not 'reconnecting', but its state.status is anything other than 'connected' (e.g. 'disconnected', 'error', 'connecting'). Unlike the reconnecting case this is not expected to resolve on its own; the user must actively reconnect. The guard sits before provider acquisition and upload-session creation so no work starts on a dead connection.","triggerScenarios":"The SSH connection is in a non-connected, non-reconnecting state (hard disconnect, auth failure, connecting-not-yet-ready) when importExternalPathsSsh runs.","commonSituations":"The SSH session hard-failed (auth, network down, host unreachable) and the manager moved to 'error'/'disconnected'; the connection is still in initial 'connecting' when the import fired; the host key changed and the connection is stuck.","solutions":["Click Reconnect on the SSH target and confirm it reaches 'connected', then retry the import.","Resolve the underlying failure (credentials, network, host key) shown in the connection status before reconnecting.","If status was 'connecting', wait for the connection to finish establishing before retrying."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Only import once the connection is fully connected\nimport { getSshConnectionManager } from './ssh'\nfunction isConnectionActive(connectionId: string): boolean {\n  return getSshConnectionManager()?.getConnection(connectionId)?.getState().status === 'connected'\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importExternalPathsSsh(sources, dest, connectionId, opts)\n} catch (e) {\n  if (e instanceof Error && /not active|reconnect/i.test(e.message)) {\n    await reconnectSshTarget(connectionId) // user-driven reconnect, then retry\n  } else throw e\n}","preventionTips":["Gate import/drop actions on status === 'connected' in the UI.","Resolve the underlying disconnect cause (credentials, network, host key) before retrying.","Wait for 'connecting' to settle into 'connected' before issuing import."],"tags":["ssh","connection","upload","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}