{"record":{"id":"a9f2a30ce7c3ec8f","repo":"different-ai/openwork","slug":"failed-to-import-github-plugin","errorCode":null,"errorMessage":"Failed to import GitHub plugin.","messagePattern":"Failed to import GitHub plugin\\.","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-screen.tsx","lineNumber":1043,"sourceCode":"      await runReauthableAction(\"import-github-connection-plugin\", async () => {\n        const result = await requestJson(\n          \"/v1/plugins/import-mcps-from-github-url\",\n          {\n            method: \"POST\",\n            body: JSON.stringify({\n              access: { orgWide: true, memberIds: [], teamIds: [] },\n              authType,\n              credentialMode: authType === \"oauth\" ? credentialMode : \"shared\",\n              githubUrl: githubUrl.trim(),\n              marketplaceId,\n              selectedServerKeys,\n              selectedSkillKeys,\n            }),\n          },\n          30000,\n        );\n        if (!result.response.ok) {\n          throw getRequestError(result.payload, result.response, \"Failed to import GitHub plugin.\");\n        }\n      });\n      await queryClient.invalidateQueries({ queryKey: mcpConnectionQueryKeys.all });\n      await queryClient.invalidateQueries({ queryKey: pluginQueryKeys.all });\n      await queryClient.invalidateQueries({ queryKey: marketplaceQueryKeys.all });\n      onImported();\n      onClose();\n    } catch (importError) {\n      setError(importError instanceof Error ? importError.message : \"Failed to import GitHub plugin.\");\n    } finally {\n      setBusy(false);\n    }\n  }\n\n  function toggleServer(serverKey: string, checked: boolean) {\n    setSelectedServerKeys((current) =>\n      checked ? [...new Set([...current, serverKey])] : current.filter((key) => key !== serverKey),\n    );","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-screen.tsx#L1025-L1061","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nthrow getRequestError(result.payload, result.response, \"Failed to import GitHub plugin.\");\n// after\nthrow getRequestError(result.payload, result.response, `Failed to import GitHub plugin (${result.response.status}).`);","handlingStrategy":"try-catch","validationCode":"if (selectedServerKeys.length === 0 && selectedSkillKeys.length === 0) {\n  throw new Error(\"Select at least one server or skill to import.\");\n}\nif (!preview || preview.servers.every((s) => !s.supported)) {\n  throw new Error(\"Run the preview again before importing.\");\n}","typeGuard":"function isReauthRequiredError(error: unknown): error is ReauthRequiredError {\n  return error instanceof ReauthRequiredError;\n}","tryCatchPattern":"try {\n  await importGithubPlugin({ githubUrl, selectedServerKeys, selectedSkillKeys });\n} catch (error) {\n  if (isReauthRequiredError(error)) return startReauth();\n  toast.error(error instanceof Error ? error.message : \"Failed to import GitHub plugin.\");\n}","preventionTips":["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."],"tags":["http","api","github-plugin","import","mutation"],"backgroundTag":"http-non-ok-response","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}