BloopAI/vibe-kanban · error · Error

pr_not_found

pr_not_found

Error message

t('createWorkspaceFromPr.errors.prNotFound')

What it means

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.

Source

Thrown at packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx:165

          head_branch: selectedPr.head_branch,
          base_branch: selectedPr.base_branch,
          run_setup: runSetup,
          remote_name: selectedRemote,
        });
        if (!result.success) {
          switch (result.error?.type) {
            case 'branch_fetch_failed':
              throw new Error(result.error.message);
            case 'auth_failed':
              throw new Error(result.error.message);
            case 'cli_not_installed':
              throw new Error(
                t('createWorkspaceFromPr.errors.cliNotInstalled', {
                  provider: result.error.provider,
                })
              );
            case 'pr_not_found':
              throw new Error(t('createWorkspaceFromPr.errors.prNotFound'));
            case 'unsupported_provider':
              throw new Error(
                t('createWorkspaceFromPr.errors.unsupportedProvider')
              );
            default:
              throw new Error(
                result.message ||
                  t('createWorkspaceFromPr.errors.failedToCreateWorkspace')
              );
          }
        }
        return result.data;
      },
      onSuccess: (data) => {
        queryClient.invalidateQueries({ queryKey: ['tasks'] });
        queryClient.invalidateQueries({ queryKey: ['workspaces'] });
        modal.hide();
        appNavigation.goToWorkspace(data.workspace.id);

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Close and reopen the dialog so listOpenPrs refreshes, then re-select a current open PR
  2. Verify the PR still exists and is open on the forge (open the PR link from the dialog)
  3. Check the selected remote is the one the PR actually belongs to (use the Remote dropdown when the repo has multiple remotes)
  4. Re-authenticate if the PR is in a private repo and may be hidden from the current token

Example fix

// before (stale list)
#42: old feature (merged 5 min ago)  -> Create -> pr_not_found
// after
refresh dialog, pick #43 -> Create -> workspace created
Defensive patterns

Strategy: validation

Validate before calling

// before creating, re-check the PR is still open
const prs = await repoApi.listOpenPrs(repoId, remoteName);
const stillOpen = prs.success && prs.data.some((p) => Number(p.number) === prNumber);
if (!stillOpen) throw new Error('PR is no longer open — refresh the list and select again');

Type guard

function isPrNotFound(e: CreateFromPrError | undefined): e is { type: 'pr_not_found' } {
  return e?.type === 'pr_not_found';
}

Try / catch

try {
  await workspacesApi.createFromPr(input);
} catch (err) {
  if (isPrNotFound(err.cause ?? err)) {
    await queryClient.invalidateQueries({ queryKey: ['open-prs', repoId, remote] });
    show('PR not found — the list was refreshed; pick the PR again.');
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/cbc9e4c1aa640a1b. Report an issue: GitHub.