different-ai/openwork · error

Failed to preview GitHub plugin.

Error message

Failed to preview GitHub plugin.

What it means

Thrown by the GitHub plugin import preview flow in mcp-connections-screen.tsx when POST /v1/plugins/import-mcps-from-github-url/preview returns a non-ok HTTP response. getRequestError extracts the server-provided error message from the JSON payload when present; otherwise it falls back to the literal message 'Failed to preview GitHub plugin.'. A 403 response with payload.error === 'reauth' is thrown as a ReauthRequiredError instead.

Source

Thrown at ee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-screen.tsx:993

  );

  async function previewGithubPlugin() {
    if (!githubUrl.trim()) {
      setError("Paste a GitHub plugin URL.");
      return;
    }
    setBusy(true);
    setError(null);
    try {
      let payload: unknown = null;
      await runReauthableAction("preview-github-connection-plugin", async () => {
        const result = await requestJson(
          "/v1/plugins/import-mcps-from-github-url/preview",
          { method: "POST", body: JSON.stringify({ githubUrl: githubUrl.trim() }) },
          20000,
        );
        if (!result.response.ok) {
          throw getRequestError(result.payload, result.response, "Failed to preview GitHub plugin.");
        }
        payload = result.payload;
      });
      const nextPreview = parseGithubPluginImportPreview(payload);
      setPreview(nextPreview);
      setSelectedServerKeys(nextPreview.servers.filter((server) => server.supported).map((server) => server.serverKey));
      setSelectedSkillKeys(nextPreview.skills.filter((skill) => skill.supported).map((skill) => skill.skillKey));
    } catch (previewError) {
      setError(previewError instanceof Error ? previewError.message : "Failed to preview GitHub plugin.");
    } finally {
      setBusy(false);
    }
  }

  async function importGithubPlugin() {
    if (!preview) {
      setError("Preview the GitHub plugin first.");
      return;

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Check the thrown error's message for the server-provided detail; if it is the fallback text, inspect the network tab for the actual response status and body of /v1/plugins/import-mcps-from-github-url/preview.
  2. Verify the GitHub URL is public (or that the Den server has credentials for it) and points at a repo containing a supported MCP configuration.
  3. Confirm the dashboard session token is valid; on 403 reauth errors, restart the sign-in flow (the error will be a ReauthRequiredError).
  4. Retry after confirming the Den server is healthy; 5xx indicates a server-side GitHub fetch failure.
  5. If the request times out (20s limit here produces a separate timeout error), check network latency to api.openworklabs.com.

Example fix

// before
const result = await requestJson("/v1/plugins/import-mcps-from-github-url/preview", { method: "POST", body: JSON.stringify({ githubUrl: githubUrl }) }, 20000);
// after
if (!/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+/.test(githubUrl.trim())) {
  setPreviewError("Enter a valid public GitHub repository URL.");
  return;
}
const result = await requestJson("/v1/plugins/import-mcps-from-github-url/preview", { method: "POST", body: JSON.stringify({ githubUrl: githubUrl.trim() }) }, 20000);
Defensive patterns

Strategy: try-catch

Validate before calling

const GITHUB_URL_RE = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+/;
if (!GITHUB_URL_RE.test(githubUrl.trim())) {
  throw new Error("Enter a valid GitHub repository URL before previewing.");
}

Type guard

function isReauthRequiredError(error: unknown): error is ReauthRequiredError {
  return error instanceof ReauthRequiredError;
}

Try / catch

try {
  const preview = await previewGithubPlugin(url);
  setPreview(preview);
} catch (error) {
  if (isReauthRequiredError(error)) return startReauth();
  setPreviewError(error instanceof Error ? error.message : "Failed to preview GitHub plugin.");
}

Prevention

When it happens

Trigger: The preview request completes (no network/timeout error) but the Den API returns 4xx/5xx: the githubUrl fails server-side validation, the URL points to a repo that is not a valid MCP config source, the workspace auth token is expired/insufficient, or the server returns 500 while fetching the GitHub repo.

Common situations: User pastes a malformed or private GitHub URL (private repo the server cannot read), a repo without a recognizable MCP server config, an expired session token, or the Den backend is down/misconfigured so GitHub fetches fail.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/5509f4bcb22114a5. Report an issue: GitHub.