BloopAI/vibe-kanban · error · Error
auth_failed
auth_failed
Error message
result.error.message
What it means
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.
Source
Thrown at packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx:157
) {
throw new Error('Missing required fields');
}
const result = await workspacesApi.createFromPr({
repo_id: selectedRepoId,
pr_number: selectedPrNumber as unknown as bigint,
pr_title: selectedPr.title,
pr_url: selectedPr.url,
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')
);
}View on GitHub (pinned to 4deb7eca8f)
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
Example fix
// before (host machine) $ gh auth status > error: token expired // after $ gh auth login && gh auth status > github.com ✓ Logged in
Defensive patterns
Strategy: try-catch
Validate before calling
// before creating
import { execSync } from 'child_process';
const forgeCliOk = (cli: string) => { try { execSync(`${cli} auth status`, { stdio: 'ignore' }); return true; } catch { return false; } };
if (!forgeCliOk('gh')) throw new Error('Run `gh auth login` before creating a workspace from a PR'); Type guard
function isAuthFailed(e: CreateFromPrError | undefined): e is { type: 'auth_failed'; message: string } {
return e?.type === 'auth_failed' && typeof (e as { message?: string }).message === 'string';
} Try / catch
try {
const result = await workspacesApi.createFromPr(input);
if (!result.success) {
if (isAuthFailed(result.error)) throw new Error(`Auth failed: ${result.error.message}. Re-run gh/glab auth login.`);
throw new Error(result.message ?? 'Workspace creation failed');
}
} catch (err) {
if (/auth|token|401/i.test((err as Error).message)) {
showReAuthPrompt(); // guide user to `gh auth login`
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- cli_not_installed
- OAuth init failed (${res.status})
- Auth methods lookup failed (${res.status})
- OAuth redeem failed (${res.status})
- Local login failed (${res.status})
AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29).
Data as JSON: /api/errors/249ab4d2c99d29dd.
Report an issue: GitHub.