{"record":{"id":"e844d76336b648d7","repo":"stablyai/orca","slug":"ssh-target-targetid-not-found","errorCode":null,"errorMessage":"SSH target \"${targetId}\" not found","messagePattern":"SSH target \"(.+?)\" not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/ipc/ssh.ts","lineNumber":1131,"sourceCode":"        connectInFlight.delete(targetId)\n      }\n    }\n  }\n\n  registeredConnectSshTarget = connectTarget\n  registeredGetSshState = (targetId: string) => getPublicSshState(targetId)\n\n  ipcMain.handle('ssh:connect', async (_event, args: { targetId: string }) => {\n    return connectTarget(args.targetId)\n  })\n\n  async function doConnect(\n    targetId: string,\n    replacePendingTransport = false\n  ): Promise<SshConnectionState> {\n    const target = sshStore!.getTarget(targetId)\n    if (!target) {\n      throw new Error(`SSH target \"${targetId}\" not found`)\n    }\n\n    const existingSession = activeSessions.get(targetId)\n    const existingState = connectionManager!.getState(targetId)\n    const existingMux = existingSession?.getMux()\n    if (\n      existingSession?.getState() === 'ready' &&\n      existingState?.status === 'connected' &&\n      connectionManager!.getConnection(targetId) &&\n      existingMux &&\n      !existingMux.isDisposed() &&\n      !relayStateOverrides.has(targetId) &&\n      !relayLostBackoff.has(targetId)\n    ) {\n      // Why: BrowserWindow reactivation re-fires ssh:connect for already-live targets; treat as a refresh instead of tearing down the relay and its forwards.\n      broadcastSshState(getCurrentMainWindow, targetId, existingState)\n      return getPublicSshState(targetId)!\n    }","sourceCodeStart":1113,"sourceCodeEnd":1149,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/ssh.ts#L1113-L1149","documentation":"Thrown inside doConnect (the SSH connect handler for 'ssh:connect') when sshStore.getTarget(targetId) returns undefined. The store is the source of truth for configured SSH targets, so a missing target means the targetId supplied by the renderer does not correspond to any saved SSH target configuration. The connect flow refuses to proceed because there is no host/user/port/credential tuple to dial.","triggerScenarios":"ipcMain 'ssh:connect' handler invoked with a targetId that was deleted, never created, or is a stale ID retained in renderer state after a config reload. Also possible if the target was renamed and the renderer is sending the old identifier.","commonSituations":"Renderer holds a cached target list and sends an ID for a target the user just removed. A persisted window-state references a target that no longer exists. A typo or copy/paste error in an automated test or script supplies a nonexistent ID.","solutions":["Refresh the SSH target list in the renderer and reconnect using a currently-valid targetId.","If the target was deleted intentionally, remove any UI affordance or saved state still referencing it.","Validate targetId against sshStore list before issuing 'ssh:connect'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const targets = await ipcRenderer.invoke('ssh:listTargets')\nif (!targets.some((t) => t.id === targetId)) {\n  throw new Error(`Unknown SSH target: ${targetId}`)\n}\nawait ipcRenderer.invoke('ssh:connect', { targetId })","typeGuard":"function isKnownTarget(targetId: string, targets: { id: string }[]): targetId is string {\n  return targets.some((t) => t.id === targetId)\n}","tryCatchPattern":"try {\n  await ipcRenderer.invoke('ssh:connect', { targetId })\n} catch (e) {\n  if (/SSH target .* not found/.test((e as Error).message)) {\n    refreshTargetList()\n    showNotification('This SSH target no longer exists.')\n  } else throw e\n}","preventionTips":["Refresh the target list from the store before showing connect affordances.","Clear renderer references to a target when it is deleted.","Avoid persisting targetId in window state without validating on load."],"tags":["ssh","validation","not-found","ipc"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}