{"record":{"id":"e40bd5dfc2a559d1","repo":"stablyai/orca","slug":"project-host-setup-not-found-args-setupid","errorCode":null,"errorMessage":"Project host setup not found: ${args.setupId}","messagePattern":"Project host setup not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/repos.ts","lineNumber":1392,"sourceCode":"      if (!result) {\n        throw new Error(`Project not found: ${args.projectId}`)\n      }\n      notifyReposChanged(mainWindow)\n      return result\n    }\n  )\n\n  ipcMain.handle(\n    'projectHostSetups:update',\n    (_event, rawArgs: ProjectHostSetupUpdateArgs): ProjectHostSetupUpdateResult => {\n      const args = parseProjectGroupIpcArgs(\n        ProjectHostSetupUpdateIpcArgs,\n        rawArgs,\n        'project_host_setup_update_invalid_args'\n      )\n      const result = store.updateProjectHostSetup(args)\n      if (!result) {\n        throw new Error(`Project host setup not found: ${args.setupId}`)\n      }\n      if ('worktreeBasePath' in args.updates && result.repo) {\n        void prepareLocalWorktreeRootForRepo(store, result.repo)\n        invalidateAuthorizedRootsCache()\n      }\n      notifyReposChanged(mainWindow)\n      return result\n    }\n  )\n\n  ipcMain.handle(\n    'projectHostSetups:delete',\n    (_event, rawArgs: ProjectHostSetupDeleteArgs): ProjectHostSetupDeleteResult => {\n      const args = parseProjectGroupIpcArgs(\n        ProjectHostSetupDeleteIpcArgs,\n        rawArgs,\n        'project_host_setup_delete_invalid_args'\n      )","sourceCodeStart":1374,"sourceCodeEnd":1410,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/repos.ts#L1374-L1410","documentation":"Thrown by the projectHostSetups:update IPC handler when store.updateProjectHostSetup returns null, i.e. no host-setup row matched args.setupId. The update is atomic in the store: a miss returns null rather than creating a row, so this signals the setup id is unknown or already deleted.","triggerScenarios":"Updating a project host setup whose setupId was removed by another action (delete, project removal, host disconnect) between the load of the settings panel and the save. Also when a setupId from an old workspace is reused.","commonSituations":"Two settings panels open against the same project; a concurrent removeProjectHostSetup invalidated the id; state cached across a workspace switch; an import/migration that did not preserve setup ids.","solutions":["Re-fetch the host setups for the project and diff against the local copy before retrying the update.","If the setup is gone, fall back to create rather than update.","Catch the error and tell the user the setup no longer exists, then refresh.","Avoid caching setup ids across workspace switches; key them by current workspace."],"exampleFix":"// before\nawait ipc.invoke('projectHostSetups:update', { setupId, updates })\n\n// after\nconst current = await ipc.invoke('projectHostSetups:list', { projectId })\nif (!current.some((s) => s.id === setupId)) {\n  await ipc.invoke('projectHostSetups:create', { projectId, hostId, ...updates })\n} else {\n  await ipc.invoke('projectHostSetups:update', { setupId, updates })\n}","handlingStrategy":"validation","validationCode":"const setups = await ipc.invoke('projectHostSetups:list', { projectId })\nif (!setups.some((s) => s.id === setupId)) {\n  // setup gone — recreate instead of update\n  await ipc.invoke('projectHostSetups:create', { projectId, hostId, ...updates })\n  return\n}\nawait ipc.invoke('projectHostSetups:update', { setupId, updates })","typeGuard":"function setupStillExists(setupId: string, setups: { id: string }[]): boolean {\n  return setups.some((s) => s.id === setupId)\n}","tryCatchPattern":"try {\n  await ipc.invoke('projectHostSetups:update', { setupId, updates })\n} catch (e) {\n  if (/not found/.test((e as Error).message)) {\n    await refreshSetups(projectId)\n  } else throw e\n}","preventionTips":["Refresh host setups whenever the project or host changes.","Key cached setup ids by current workspace and host.","For concurrent editors, reconcile on focus before saving."],"tags":["ipc","repos","project-host-setup","not-found","concurrency"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}