{"record":{"id":"cbc9e4c1aa640a1b","repo":"BloopAI/vibe-kanban","slug":"pr-not-found","errorCode":"pr_not_found","errorMessage":"t('createWorkspaceFromPr.errors.prNotFound')","messagePattern":"t\\('createWorkspaceFromPr\\.errors\\.prNotFound'\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx","lineNumber":165,"sourceCode":"          head_branch: selectedPr.head_branch,\n          base_branch: selectedPr.base_branch,\n          run_setup: runSetup,\n          remote_name: selectedRemote,\n        });\n        if (!result.success) {\n          switch (result.error?.type) {\n            case 'branch_fetch_failed':\n              throw new Error(result.error.message);\n            case 'auth_failed':\n              throw new Error(result.error.message);\n            case 'cli_not_installed':\n              throw new Error(\n                t('createWorkspaceFromPr.errors.cliNotInstalled', {\n                  provider: result.error.provider,\n                })\n              );\n            case 'pr_not_found':\n              throw new Error(t('createWorkspaceFromPr.errors.prNotFound'));\n            case 'unsupported_provider':\n              throw new Error(\n                t('createWorkspaceFromPr.errors.unsupportedProvider')\n              );\n            default:\n              throw new Error(\n                result.message ||\n                  t('createWorkspaceFromPr.errors.failedToCreateWorkspace')\n              );\n          }\n        }\n        return result.data;\n      },\n      onSuccess: (data) => {\n        queryClient.invalidateQueries({ queryKey: ['tasks'] });\n        queryClient.invalidateQueries({ queryKey: ['workspaces'] });\n        modal.hide();\n        appNavigation.goToWorkspace(data.workspace.id);","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx#L147-L183","documentation":"This error surfaces when workspacesApi.createFromPr returns { success: false, error: { type: 'pr_not_found' } }. The backend could not resolve the pull request when creating the workspace — typically the PR was closed/merged/deleted between listing and creation, or was fetched from the wrong remote. The dialog maps it to the localized createWorkspaceFromPr.errors.prNotFound message.","triggerScenarios":"Create Workspace clicked with a selectedPrNumber whose PR no longer exists or is not visible; workspacesApi.createFromPr resolves success:false with error.type 'pr_not_found'. Race between listOpenPrs (queried earlier) and createFromPr.","commonSituations":"PR was merged or closed by someone else while the dialog sat open; PR number typed/stale-cached from a different remote; private PR no longer accessible after token change; repo was re-created or force-pushed renumbering refs.","solutions":["Close and reopen the dialog so listOpenPrs refreshes, then re-select a current open PR","Verify the PR still exists and is open on the forge (open the PR link from the dialog)","Check the selected remote is the one the PR actually belongs to (use the Remote dropdown when the repo has multiple remotes)","Re-authenticate if the PR is in a private repo and may be hidden from the current token"],"exampleFix":"// before (stale list)\n#42: old feature (merged 5 min ago)  -> Create -> pr_not_found\n// after\nrefresh dialog, pick #43 -> Create -> workspace created","handlingStrategy":"validation","validationCode":"// before creating, re-check the PR is still open\nconst prs = await repoApi.listOpenPrs(repoId, remoteName);\nconst stillOpen = prs.success && prs.data.some((p) => Number(p.number) === prNumber);\nif (!stillOpen) throw new Error('PR is no longer open — refresh the list and select again');","typeGuard":"function isPrNotFound(e: CreateFromPrError | undefined): e is { type: 'pr_not_found' } {\n  return e?.type === 'pr_not_found';\n}","tryCatchPattern":"try {\n  await workspacesApi.createFromPr(input);\n} catch (err) {\n  if (isPrNotFound(err.cause ?? err)) {\n    await queryClient.invalidateQueries({ queryKey: ['open-prs', repoId, remote] });\n    show('PR not found — the list was refreshed; pick the PR again.');\n  }\n}","preventionTips":["Invalidate/re-fetch open PRs right before creation instead of trusting a long-open dialog","Disable or annotate PR options that are merged/closed","Verify PR number and remote pairing before submit","For private repos, confirm the token can see the PR"],"tags":["git","pull-request","stale-data"],"backgroundTag":"pull-request-not-found","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}