BloopAI/vibe-kanban · error · Error
result.message || t('createWorkspaceFromPr.errors.failedToCr
Error message
result.message || t('createWorkspaceFromPr.errors.failedToCreateWorkspace') What it means
This is the default arm of the createFromPr result switch: when success is false and error.type matches none of the known CreateFromPrError variants, the dialog throws result.message (backend-provided generic message) or falls back to the localized failedToCreateWorkspace string. It represents any unrecognized creation failure returned by the backend.
Source
Thrown at packages/web-core/src/shared/dialogs/command-bar/CreateWorkspaceFromPrDialog.tsx:171
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);
},
});
useEffect(() => {
if (!modal.visible) {
setSelectedRepoId(null);View on GitHub (pinned to 4deb7eca8f)
Solutions
- Read result.message in the devtools/network response for the real backend error text
- Rebuild/regenerate shared types (pnpm run generate-types) so frontend and backend CreateFromPrError variants match
- Retry the operation; if it persists, check backend logs for the workspace creation request
- Add a case for the new error type in the switch if a new variant was introduced upstream
Example fix
// before
export type CreateFromPrError = ... | { type: 'unsupported_provider' };
// after (regenerated after backend added a variant)
export type CreateFromPrError = ... | { type: 'unsupported_provider' } | { type: 'new_variant', message: string }; Defensive patterns
Strategy: try-catch
Validate before calling
// keep the frontend's CreateFromPrError in sync; CI check: // pnpm run generate-types:check — fails when shared/types.ts diverges from the Rust source
Type guard
function hasKnownErrorType(e: unknown): e is CreateFromPrError {
const known = ['pr_not_found','branch_fetch_failed','cli_not_installed','auth_failed','unsupported_provider'];
return typeof e === 'object' && e !== null && 'type' in e && known.includes((e as { type: string }).type);
} Try / catch
try {
const result = await workspacesApi.createFromPr(input);
if (!result.success) {
if (hasKnownErrorType(result.error)) throw new Error(describe(result.error));
throw new Error(result.message ?? t('createWorkspaceFromPr.errors.failedToCreateWorkspace'));
}
} catch (err) {
logToTelemetry('create_from_pr_unclassified', { raw: (err as Error).message });
show((err as Error).message);
} Prevention
- Regenerate shared types whenever backend error enums change (pnpm run generate-types)
- Always carry a top-level `message` in error responses for fallback display
- Add exhaustive switch checks (`satisfies never`) so new variants break the build
- Log unclassified error payloads for diagnosis
When it happens
Trigger: workspacesApi.createFromPr resolves success:false with an error.type outside {branch_fetch_failed, auth_failed, cli_not_installed, pr_not_found, unsupported_provider}, or result.message is set while error is absent/unknown; thrown as the mutation error and shown in the dialog.
Common situations: Shared type drift between frontend and backend after an upgrade adds a new CreateFromPrError variant; transient backend/internal errors surfaced with only a top-level message; serialization mismatch producing an unclassifiable payload.
Related errors
- Invitation not found (${res.status})
- Failed to accept invitation (${res.status})
- Failed to list organizations (${res.status})
- Failed to fetch identity (${res.status})
- Failed to list projects (${res.status})
AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29).
Data as JSON: /api/errors/359dfb56bf575580.
Report an issue: GitHub.