{"record":{"id":"7b46a88aff41273b","repo":"stablyai/orca","slug":"project-not-found-args-projectid","errorCode":null,"errorMessage":"Project not found: ${args.projectId}","messagePattern":"Project not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/repos.ts","lineNumber":1375,"sourceCode":"\n  ipcMain.handle('projectHostSetups:list', () => {\n    enrichMissingRepoGitRemoteIdentities(store, {\n      onChanged: () => notifyReposChanged(mainWindow)\n    })\n    return store.getProjectHostSetups()\n  })\n\n  ipcMain.handle(\n    'projectHostSetups:create',\n    (_event, rawArgs: ProjectHostSetupCreateArgs): ProjectHostSetupCreateResult => {\n      const args = parseProjectGroupIpcArgs(\n        ProjectHostSetupCreateIpcArgs,\n        rawArgs,\n        'project_host_setup_create_invalid_args'\n      )\n      const result = store.createProjectHostSetup(args)\n      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      }","sourceCodeStart":1357,"sourceCodeEnd":1393,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/repos.ts#L1357-L1393","documentation":"Thrown by the projectHostSetups:create IPC handler when store.createProjectHostSetup returns a falsy result, meaning no project record matched args.projectId. The handler first validates args via ProjectHostSetupCreateIpcArgs, so a thrown error here means the arguments were well-formed but referenced a project that does not exist in the store.","triggerScenarios":"Sending projectHostSetups:create with a projectId that was deleted, never created, or scoped to a different workspace. Also occurs when the renderer holds a stale project id after a workspace switch or after repos:changed invalidated the project list.","commonSituations":"Stale renderer state after a project was removed in another window; a drag-and-drop or bulk action referencing an id from a cached list; race where a project is deleted between the list refresh and the create call.","solutions":["Refresh the project list (repos:changed / listProjects) on the renderer before retrying and drop the orphaned id.","Guard the create call with a prior store.getRepo/getProject existence check on the renderer.","Catch the error in the renderer, surface a 'project no longer exists' message, and clear local references to that id.","Audit bulk flows to ensure ids are fetched immediately before use rather than from long-lived caches."],"exampleFix":"// before\nawait ipc.invoke('projectHostSetups:create', { projectId, hostId })\n\n// after\nconst exists = await ipc.invoke('repos:get', projectId)\nif (!exists) {\n  showNotice('Project was removed elsewhere.')\n  return\n}\nawait ipc.invoke('projectHostSetups:create', { projectId, hostId })","handlingStrategy":"validation","validationCode":"const project = await ipc.invoke('repos:get', projectId)\nif (!project) {\n  showNotice('This project no longer exists.')\n  return\n}\nawait ipc.invoke('projectHostSetups:create', { projectId, hostId, ...rest })","typeGuard":"function isExistingProjectId(id: string, projects: { id: string }[]): boolean {\n  return projects.some((p) => p.id === id)\n}","tryCatchPattern":"try {\n  await ipc.invoke('projectHostSetups:create', args)\n} catch (e) {\n  if (/Project not found/.test((e as Error).message)) {\n    refreshProjectList()\n    showNotice('Project was removed; please retry.')\n  } else throw e\n}","preventionTips":["Re-fetch the project list when the window regains focus or on repos:changed events.","Do not cache projectId across workspace switches.","Disable create actions in the UI when the source project row is no longer present."],"tags":["ipc","repos","project-host-setup","not-found","stale-state"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}