{"record":{"id":"b85032cdc9afaf6a","repo":"stablyai/orca","slug":"no-ssh-connection-for-connectionid","errorCode":null,"errorMessage":"No SSH connection for \"${connectionId}\"","messagePattern":"No SSH connection for \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/filesystem-import-ssh.ts","lineNumber":31,"sourceCode":"  uploadSshImportDirectory\n} from './filesystem-import-ssh-directory'\n\n// Why: the SSH import path uses SshFilesystemProvider instead of direct SFTP so\n// system-SSH transports (ProxyCommand/ProxyJump/FIDO2) get the same workflows.\nexport async function importExternalPathsSsh(\n  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  }","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/filesystem-import-ssh.ts#L13-L49","documentation":"Thrown by importExternalPathsSsh() when getSshConnectionManager() returns no manager or getConnection(connectionId) returns no connection. It fires before any state check, meaning the connectionId is not registered at all — there is no live or historic connection object for that id. The quoted id in the message identifies which connection the caller expected.","triggerScenarios":"fs:ImportExternalPaths (or the terminal-drop staging path) is invoked with a connectionId that was never connected, was disconnected and evicted from the manager, or came from a stale renderer reference after the SSH target was removed.","commonSituations":"Renderer holds a connectionId from a previous session after the target was disconnected/closed; a race where the user initiated an import just as the connection tore down; the SSH target was deleted from settings while an import was queued.","solutions":["Re-establish the SSH connection so a current connectionId is available, then retry the import.","Refresh the renderer's connectionId reference from the connection manager before invoking import.","Disable the import/drop action in the UI when no active connection exists for the target."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Verify the connection is registered before invoking import\nimport { getSshConnectionManager } from './ssh'\nfunction isConnectionKnown(connectionId: string): boolean {\n  return !!getSshConnectionManager()?.getConnection(connectionId)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importExternalPathsSsh(sources, dest, connectionId, opts)\n} catch (e) {\n  if (e instanceof Error && /No SSH connection/.test(e.message)) {\n    await reconnectSshTarget(connectionId) // then retry with the fresh connectionId\n  } else throw e\n}","preventionTips":["Disable import/drop actions when no connection is registered for the target.","Refresh the renderer's connectionId from the connection manager after disconnects.","Evict stale connectionIds from renderer state when the target is removed."],"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"}