{"record":{"id":"c6f2b70f2afb6728","repo":"stablyai/orca","slug":"ssh-connection-args-connectionid-not-found-or","errorCode":null,"errorMessage":"SSH connection \"${args.connectionId}\" not found or not connected","messagePattern":"SSH connection \"(.+?)\" not found or not connected","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/repos.ts","lineNumber":488,"sourceCode":"  const trimmed = remotePath.replace(/[\\\\/]+$/, '')\n  if (!trimmed) {\n    return remotePath\n  }\n  return trimmed.split(/[\\\\/]/).at(-1) || remotePath\n}\n\nasync function cloneRemoteRepo(\n  store: Store,\n  mainWindow: BrowserWindow,\n  args: {\n    connectionId: string\n    url: string\n    destination: string\n  }\n): Promise<Repo> {\n  const gitProvider = getSshGitProvider(args.connectionId)\n  if (!gitProvider) {\n    throw new Error(`SSH connection \"${args.connectionId}\" not found or not connected`)\n  }\n  const fsProvider = getSshFilesystemProvider(args.connectionId)\n  if (!fsProvider) {\n    throw new Error(`SSH connection \"${args.connectionId}\" not found or not connected`)\n  }\n  const host = gitProvider.getHostPlatform?.()\n  if (!host) {\n    throw new Error('SSH host platform is unavailable. Reconnect the SSH target before cloning.')\n  }\n  const trimmedDestination = await resolveRemoteHomePath(args.connectionId, args.destination.trim())\n  if (!isRuntimePathAbsolute(trimmedDestination, host.pathFlavor)) {\n    throw new Error('Clone destination must be an absolute path on the SSH host')\n  }\n  const repoName = deriveCloneRepoNameFromUrl(args.url.trim())\n  const clonePath = joinRemotePath(host, trimmedDestination, repoName)\n  if (relativePathInsideRoot(trimmedDestination, clonePath) === null) {\n    throw new Error('Clone path must be inside the destination directory')\n  }","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/repos.ts#L470-L506","documentation":"Thrown by cloneRemoteRepo when getSshGitProvider(args.connectionId) returns a falsy value. The SSH git provider is registered per active connection; a missing provider means no connection with that id is registered as a git-capable provider. This is a precondition check before any filesystem/host work — the clone cannot run without a git provider bound to the connection.","triggerScenarios":"Calling the clone IPC with a connectionId that has no live SSH git provider: connection never connected, disconnected, expired, or connectionId is wrong/stale. getSshGitProvider(connectionId) returns undefined.","commonSituations":"SSH connection dropped before the clone started; connectionId from a stale workspace that reconnected under a new id; relay registered a filesystem provider but not a git provider; clone triggered from a cached connection list after a restart.","solutions":["Reconnect the SSH target and retry the clone with the new connectionId.","Confirm getSshGitProvider(connectionId) returns a value before calling cloneRemoteRepo.","Validate the connectionId against the live connection list (and that it has a git provider) before invoking the clone IPC.","If the relay only registered a filesystem provider, ensure the relay supports and advertised git operations."],"exampleFix":"// before\nawait cloneRemoteRepo(store, mainWindow, { connectionId, url, destination })\n\n// after — guard before the call\nimport { getSshGitProvider } from '../providers/ssh-git-dispatch'\nif (!getSshGitProvider(connectionId)) {\n  throw new Error(`Reconnect the SSH target '${connectionId}' before cloning.`)\n}\nawait cloneRemoteRepo(store, mainWindow, { connectionId, url, destination })","handlingStrategy":"validation","validationCode":"import { getSshGitProvider } from '../providers/ssh-git-dispatch'\n\nfunction connectionHasGitProvider(connectionId: string): boolean {\n  return !!getSshGitProvider(connectionId)\n}","typeGuard":"function isSshConnectionMissing(err: unknown): boolean {\n  return err instanceof Error && /SSH connection .* not found or not connected/.test(err.message)\n}","tryCatchPattern":"if (!getSshGitProvider(connectionId)) {\n  surfaceUserAction(`Reconnect the SSH target '${connectionId}' before cloning.`)\n  return\n}\ntry {\n  await cloneRemoteRepo(store, mainWindow, { connectionId, url, destination })\n} catch (err) {\n  if (isSshConnectionMissing(err)) {\n    surfaceUserAction('SSH connection lost. Reconnect and retry.')\n    return\n  }\n  throw err\n}","preventionTips":["Confirm getSshGitProvider(connectionId) returns a value before calling the clone IPC.","Reconnect the SSH target before issuing clone requests after a workspace reload.","Track live connection ids and reject stale connectionIds at the caller."],"tags":["ssh","clone","connection","git-provider","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}