stablyai/orca · error · Error

SSH connection "${args.connectionId}" not found or not conne

Error message

SSH connection "${args.connectionId}" not found or not connected

What it means

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.

Source

Thrown at src/main/ipc/repos.ts:488

  const trimmed = remotePath.replace(/[\\/]+$/, '')
  if (!trimmed) {
    return remotePath
  }
  return trimmed.split(/[\\/]/).at(-1) || remotePath
}

async function cloneRemoteRepo(
  store: Store,
  mainWindow: BrowserWindow,
  args: {
    connectionId: string
    url: string
    destination: string
  }
): Promise<Repo> {
  const gitProvider = getSshGitProvider(args.connectionId)
  if (!gitProvider) {
    throw new Error(`SSH connection "${args.connectionId}" not found or not connected`)
  }
  const fsProvider = getSshFilesystemProvider(args.connectionId)
  if (!fsProvider) {
    throw new Error(`SSH connection "${args.connectionId}" not found or not connected`)
  }
  const host = gitProvider.getHostPlatform?.()
  if (!host) {
    throw new Error('SSH host platform is unavailable. Reconnect the SSH target before cloning.')
  }
  const trimmedDestination = await resolveRemoteHomePath(args.connectionId, args.destination.trim())
  if (!isRuntimePathAbsolute(trimmedDestination, host.pathFlavor)) {
    throw new Error('Clone destination must be an absolute path on the SSH host')
  }
  const repoName = deriveCloneRepoNameFromUrl(args.url.trim())
  const clonePath = joinRemotePath(host, trimmedDestination, repoName)
  if (relativePathInsideRoot(trimmedDestination, clonePath) === null) {
    throw new Error('Clone path must be inside the destination directory')
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Reconnect the SSH target and retry the clone with the new connectionId.
  2. Confirm getSshGitProvider(connectionId) returns a value before calling cloneRemoteRepo.
  3. Validate the connectionId against the live connection list (and that it has a git provider) before invoking the clone IPC.
  4. If the relay only registered a filesystem provider, ensure the relay supports and advertised git operations.

Example fix

// before
await cloneRemoteRepo(store, mainWindow, { connectionId, url, destination })

// after — guard before the call
import { getSshGitProvider } from '../providers/ssh-git-dispatch'
if (!getSshGitProvider(connectionId)) {
  throw new Error(`Reconnect the SSH target '${connectionId}' before cloning.`)
}
await cloneRemoteRepo(store, mainWindow, { connectionId, url, destination })
Defensive patterns

Strategy: validation

Validate before calling

import { getSshGitProvider } from '../providers/ssh-git-dispatch'

function connectionHasGitProvider(connectionId: string): boolean {
  return !!getSshGitProvider(connectionId)
}

Type guard

function isSshConnectionMissing(err: unknown): boolean {
  return err instanceof Error && /SSH connection .* not found or not connected/.test(err.message)
}

Try / catch

if (!getSshGitProvider(connectionId)) {
  surfaceUserAction(`Reconnect the SSH target '${connectionId}' before cloning.`)
  return
}
try {
  await cloneRemoteRepo(store, mainWindow, { connectionId, url, destination })
} catch (err) {
  if (isSshConnectionMissing(err)) {
    surfaceUserAction('SSH connection lost. Reconnect and retry.')
    return
  }
  throw err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/c6f2b70f2afb6728. Report an issue: GitHub.