{"record":{"id":"b8f3d9edcb5bed9a","repo":"stablyai/orca","slug":"repo-not-found-args-repoid","errorCode":null,"errorMessage":"Repo not found: ${args.repoId}","messagePattern":"Repo not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/worktrees.ts","lineNumber":2194,"sourceCode":"        return\n      }\n      try {\n        await prefetchWorktreeCreateBase({ repo, baseBranch: args.baseBranch, runtime })\n      } catch {\n        // Why: optimistic warm-up; the real create path awaits the same refresh and reports failures there.\n      }\n    }\n  )\n\n  ipcMain.handle(\n    'worktrees:create',\n    async (_event, rawArgs: CreateWorktreeArgs): Promise<CreateWorktreeResult> => {\n      const args = normalizeLinkedWorkItemFields(rawArgs)\n      // Why span here: parent the child git spans for the trace tree; don't attach branch name/remote URL (user content) — repo ID is the safer correlator.\n      return withWorktreeSpan({ stage: 'create' }, async () => {\n        const repo = store.getRepo(args.repoId)\n        if (!repo) {\n          throw new Error(`Repo not found: ${args.repoId}`)\n        }\n\n        const sourceParse = workspaceSourceSchema.safeParse(args.telemetrySource)\n        const source: WorkspaceSource = sourceParse.success ? sourceParse.data : 'unknown'\n\n        const automationProvenance = resolveAutomationWorkspaceProvenance({\n          authority: runtime,\n          repoSelector: args.repoId,\n          repo,\n          request: args.automationProvenanceRequest\n        })\n        const createArgs: CreateWorktreeArgsWithSystemProvenance = {\n          ...args,\n          automationProvenance\n        }\n\n        let result: CreateWorktreeResult\n        try {","sourceCodeStart":2176,"sourceCodeEnd":2212,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/worktrees.ts#L2176-L2212","documentation":"Thrown at the top of the worktrees:create IPC handler after store.getRepo(args.repoId) returns undefined. The repository must be registered in the store before any worktree can be created from it. The repoId is the sole correlator used here (deliberately, to avoid leaking branch/remote content).","triggerScenarios":"A worktrees:create invoke with a repoId that is not in the store — typo, stale renderer state after the repo was removed, or a race where the repo was deleted between the UI loading and the create call.","commonSituations":"Renderer holds a cached repo list after the user removed the repo; an automation/remote client sends an outdated repoId; or folder/SSH repo registration hasn't completed yet when create fires.","solutions":["Refresh the renderer's repo list and confirm the repoId still exists before offering create.","If automating, query the current repos first and use a live repoId.","Guard the create call by checking store/repos state in the renderer and disabling the action when the repo is gone."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const repos = await invoke('repos:list')\nif (!repos.some((r) => r.id === repoId)) {\n  throw new Error(`Cannot create worktree: repo ${repoId} is not registered`)\n}\nawait invoke('worktrees:create', { repoId, /* ... */ })","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Refresh the repo list before offering create.","Disable create when the selected repo is no longer in the list.","For automation, resolve a live repoId immediately before calling create."],"tags":["validation","ipc","worktree-create","repo-lookup"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}