different-ai/openwork · error
Failed to import GitHub plugin.
Error message
Failed to import GitHub plugin.
What it means
Thrown by the GitHub plugin import confirmation flow when the import request (POST with selected skill/server keys) returns a non-ok HTTP response after a 30s window. getRequestError surfaces the server error message, or the fallback 'Failed to import GitHub plugin.' when the payload carries none. As with the other mutations here, a 403 'reauth' payload becomes a ReauthRequiredError instead.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-screen.tsx:1043
await runReauthableAction("import-github-connection-plugin", async () => {
const result = await requestJson(
"/v1/plugins/import-mcps-from-github-url",
{
method: "POST",
body: JSON.stringify({
access: { orgWide: true, memberIds: [], teamIds: [] },
authType,
credentialMode: authType === "oauth" ? credentialMode : "shared",
githubUrl: githubUrl.trim(),
marketplaceId,
selectedServerKeys,
selectedSkillKeys,
}),
},
30000,
);
if (!result.response.ok) {
throw getRequestError(result.payload, result.response, "Failed to import GitHub plugin.");
}
});
await queryClient.invalidateQueries({ queryKey: mcpConnectionQueryKeys.all });
await queryClient.invalidateQueries({ queryKey: pluginQueryKeys.all });
await queryClient.invalidateQueries({ queryKey: marketplaceQueryKeys.all });
onImported();
onClose();
} catch (importError) {
setError(importError instanceof Error ? importError.message : "Failed to import GitHub plugin.");
} finally {
setBusy(false);
}
}
function toggleServer(serverKey: string, checked: boolean) {
setSelectedServerKeys((current) =>
checked ? [...new Set([...current, serverKey])] : current.filter((key) => key !== serverKey),
);View on GitHub (pinned to 2b7df46e8a)
Solutions
- Re-run the preview step and import again immediately — stale preview state is the most common cause.
- Read the thrown message for the server detail; on payment_required, add seats/upgrade the org subscription.
- Check the import request payload: selectedServerKeys/selectedSkillKeys must come from the latest preview response.
- On 401/403, re-authenticate; on 403 with error 'reauth', follow the workspace reauth flow.
- Inspect server logs or retry later if the status is 5xx (backend import failure).
Example fix
// before
throw getRequestError(result.payload, result.response, "Failed to import GitHub plugin.");
// after
throw getRequestError(result.payload, result.response, `Failed to import GitHub plugin (${result.response.status}).`); Defensive patterns
Strategy: try-catch
Validate before calling
if (selectedServerKeys.length === 0 && selectedSkillKeys.length === 0) {
throw new Error("Select at least one server or skill to import.");
}
if (!preview || preview.servers.every((s) => !s.supported)) {
throw new Error("Run the preview again before importing.");
} Type guard
function isReauthRequiredError(error: unknown): error is ReauthRequiredError {
return error instanceof ReauthRequiredError;
} Try / catch
try {
await importGithubPlugin({ githubUrl, selectedServerKeys, selectedSkillKeys });
} catch (error) {
if (isReauthRequiredError(error)) return startReauth();
toast.error(error instanceof Error ? error.message : "Failed to import GitHub plugin.");
} Prevention
- Import immediately after a successful preview so preview state cannot go stale.
- Re-run preview if the repo or selection changed before confirming the import.
- Check org plugin quota/payment status before bulk imports.
- Invalidate mcp/plugin/marketplace query caches (the code already does) so failures reflect fresh state.
When it happens
Trigger: POST to the GitHub plugin import endpoint returns 4xx/5xx: the preview token/state expired before confirm, a selected serverKey/skillKey is no longer supported server-side, the workspace hit a plugin quota or payment_required gate, or auth expired between preview and import.
Common situations: User leaves the preview dialog open until the session expires, the repo changed on GitHub between preview and import, org plugin limits are reached, or the backend import job fails on a server error.
Related errors
- Workflow action failed (${response.status}).
- Failed to preview GitHub plugin.
- Failed to create the dashboard (${response.status}).
- Failed to update the dashboard (${response.status}).
- Failed to update plugin (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/a9f2a30ce7c3ec8f.
Report an issue: GitHub.