stablyai/orca · error · Error

Remote connection dropped. Click Reconnect on the SSH target

Error message

Remote connection dropped. Click Reconnect on the SSH target before retrying.

What it means

Thrown inside the upstream-ref watch resolver (setWorktreeGitStatusRefWatch binding) when args.connectionId is set but getSshGitProvider returns undefined. Unlike the one-shot handlers, this is a long-lived watch: a providerGeneration is captured at setup, and if the relay session drops before the watch resolves resolveGitStatusUpstreamRef, the provider lookup at git-status-upstream-ref-watch-request.ts:45 fails. The watch then surfaces this error to its consumer.

Source

Thrown at src/main/ipc/git-status-upstream-ref-watch-request.ts:45

export function applyGitStatusUpstreamRefWatchRequest(
  store: Store,
  args: GitStatusUpstreamRefWatchRequest
): Promise<void> {
  const providerGeneration = args.connectionId
    ? getSshGitProviderGeneration(args.connectionId)
    : undefined
  return setWorktreeGitStatusRefWatch(
    { ...args, ...(providerGeneration !== undefined ? { providerGeneration } : {}) },
    async (bindingSignal) => {
      if (!args.branch || !args.upstreamName) {
        return undefined
      }
      const signal = boundedSignal(bindingSignal)
      if (args.connectionId) {
        const provider = getSshGitProvider(args.connectionId)
        if (!provider) {
          throw new Error(SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE)
        }
        return resolveGitStatusUpstreamRef(
          (gitArgs, cwd, requestSignal) =>
            provider.exec(gitArgs, cwd, {
              signal: requestSignal,
              timeoutMs: UPSTREAM_REF_RESOLUTION_TIMEOUT_MS
            }),
          args.worktreePath,
          args.branch,
          args.upstreamName,
          signal
        )
      }

      const worktreePath = await resolveRegisteredWorktreePath(args.worktreePath, store)
      const repo = getLocalRepoForRegisteredWorktree(store, args.worktreePath, worktreePath)
      const gitOptions = getLocalGitOptionsForRepo(store, repo)
      return resolveGitStatusUpstreamRef(

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Reconnect the SSH target so a new provider (new generation) registers, then let the watch re-subscribe.
  2. Ensure the watch consumer reacts to a generation change / provider-unavailable result by re-binding rather than leaving a stale watch.
  3. Raise SSH keepalive to keep long-lived watches alive.
  4. Treat the provider-unavailable result as a transient watch error and re-establish after reconnect instead of surfacing a hard failure.

Example fix

// before — watch fires blindly even when provider dropped mid-binding
provider = getSshGitProvider(args.connectionId)
if (!provider) { throw new Error(SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE) }

// after — treat as transient: re-bind watch on next generation after reconnect
if (!provider) {
  requestWatchRebindOnReconnect(args.connectionId)
  return undefined
}
Defensive patterns

Strategy: validation

Validate before calling

// In the watch binding: if the provider dropped mid-watch, signal rebind instead of throwing
const provider = getSshGitProvider(args.connectionId)
if (!provider) {
  return { kind: 'provider-unavailable', connectionId: args.connectionId }
}

Type guard

export function hasLiveSshProvider(connectionId?: string): connectionId is string {
  return typeof connectionId === 'string' && getSshGitProvider(connectionId) !== undefined
}

Try / catch

// Watch consumer: treat provider-unavailable as transient, rebind after reconnect
try {
  result = await resolveUpstreamRefWatch(args)
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Remote connection dropped')) {
    scheduleWatchRebindOnReconnect(args.connectionId)
    return
  }
  throw e
}

Prevention

When it happens

Trigger: A worktree git-status upstream ref watch is established for a remote worktree (args.branch and args.upstreamName both set, connectionId set). The SSH relay session disconnects between watch registration and ref resolution (or mid-watch on a refresh), so getSshGitProvider(args.connectionId) is undefined when the binding callback runs.

Common situations: Status bar polling an upstream ref on a remote worktree when the SSH session idle-times-out or the network flaps; reconnect incremented the provider generation, invalidating the captured binding; relay restarted while the watch was active.

Related errors


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