{"record":{"id":"249ab4d2c99d29dd","repo":"BloopAI/vibe-kanban","slug":"auth-failed","errorCode":"auth_failed","errorMessage":"result.error.message","messagePattern":"result\\.error\\.message","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx","lineNumber":157,"sourceCode":"        ) {\n          throw new Error('Missing required fields');\n        }\n        const result = await workspacesApi.createFromPr({\n          repo_id: selectedRepoId,\n          pr_number: selectedPrNumber as unknown as bigint,\n          pr_title: selectedPr.title,\n          pr_url: selectedPr.url,\n          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          }","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx#L139-L175","documentation":"This error surfaces when workspacesApi.createFromPr returns { success: false, error: { type: 'auth_failed', message } }. The backend (Rust) failed to authenticate with the git forge (GitHub/GitLab/etc.) via its CLI (gh/gl/lab) while fetching PR metadata or branches. The dialog re-throws result.error.message, which is the backend's raw auth failure text, and the mutation renders it in the dialog's error area.","triggerScenarios":"User clicks Create Workspace in CreateWorkspaceFromPrDialog and workspacesApi.createFromPr resolves success:false with error.type 'auth_failed' — the forge CLI on the host machine is logged out, the token expired, or the token lacks scopes for the repo hosting the selected PR.","commonSituations":"gh CLI auth token expired (gh auth login done months ago); CI-managed token missing repo scope; user switched between GitHub.com and GitHub Enterprise accounts; GitLab token revoked; host machine never ran the forge CLI login.","solutions":["Re-authenticate the forge CLI on the host machine, e.g. `gh auth login` (GitHub) or `glab auth login` (GitLab)","Verify the token works: `gh auth status` / `glab auth status`, and refresh if expired","Confirm the authenticated account has read access to the repository containing the PR","Retry Create Workspace after re-auth; if it persists, check the remote URL matches the provider you authenticated with"],"exampleFix":"// before (host machine)\n$ gh auth status\n> error: token expired\n// after\n$ gh auth login && gh auth status\n> github.com  ✓ Logged in","handlingStrategy":"try-catch","validationCode":"// before creating\nimport { execSync } from 'child_process';\nconst forgeCliOk = (cli: string) => { try { execSync(`${cli} auth status`, { stdio: 'ignore' }); return true; } catch { return false; } };\nif (!forgeCliOk('gh')) throw new Error('Run `gh auth login` before creating a workspace from a PR');","typeGuard":"function isAuthFailed(e: CreateFromPrError | undefined): e is { type: 'auth_failed'; message: string } {\n  return e?.type === 'auth_failed' && typeof (e as { message?: string }).message === 'string';\n}","tryCatchPattern":"try {\n  const result = await workspacesApi.createFromPr(input);\n  if (!result.success) {\n    if (isAuthFailed(result.error)) throw new Error(`Auth failed: ${result.error.message}. Re-run gh/glab auth login.`);\n    throw new Error(result.message ?? 'Workspace creation failed');\n  }\n} catch (err) {\n  if (/auth|token|401/i.test((err as Error).message)) {\n    showReAuthPrompt(); // guide user to `gh auth login`\n  }\n}","preventionTips":["Run `gh auth status` / `glab auth status` as a preflight before PR operations","Alert users before token expiry where the CLI supports it","Ensure backend process PATH includes the forge CLIs","Document required token scopes for private repos"],"tags":["authentication","git-forge","cli"],"backgroundTag":"forge-cli-auth-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}