different-ai/openwork · error

Failed to preview GitHub plugin components.

Error message

Failed to preview GitHub plugin components.

What it means

previewImport in plugin-import-screen.tsx throws this when POSTing a githubUrl to /v1/plugins/import-mcps-from-github-url/preview returns non-ok. The endpoint asks the Den server to fetch and parse the GitHub repo into importable components; the error means the server-side fetch/parse failed. Payload from getRequestError holds the server's reason.

Source

Thrown at ee/apps/den-web/app/(den)/dashboard/_components/plugin-import-screen.tsx:78

    try {
      normalizedGithubUrl = normalizePublicGitHubPluginUrl(githubUrl);
    } catch (urlError) {
      setError(urlError instanceof Error ? urlError.message : "Enter a valid public GitHub plugin URL.");
      return;
    }

    setBusy(true);
    setError(null);
    try {
      let payload: unknown = null;
      await runReauthableAction("preview-github-plugin-components", async () => {
        const result = await requestJson(
          "/v1/plugins/import-mcps-from-github-url/preview",
          { method: "POST", body: JSON.stringify({ githubUrl: normalizedGithubUrl }) },
          20000,
        );
        if (!result.response.ok) {
          throw getRequestError(result.payload, result.response, "Failed to preview GitHub plugin components.");
        }
        payload = result.payload;
      });
      const nextPreview = parsePluginImportPreview(payload);
      setGithubUrl(normalizedGithubUrl);
      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 components.");
    } finally {
      setBusy(false);
    }
  }

  function continueToCreate() {
    if (!preview || (selectedServerKeys.length === 0 && selectedSkillKeys.length === 0)) {
      setError("Select at least one supported MCP server or skill.");

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Verify the URL is a public GitHub repository URL (https://github.com/owner/repo...) and correct typos.
  2. If the repo is private, make it public or use the org's configured GitHub connection with access.
  3. Check the server payload: 429/502 indicates GitHub rate limiting — wait and retry.
  4. Confirm the repo actually contains MCP/plugin components the importer recognizes.

Example fix

// before
await previewImport(userInput);
// after: cheap client-side sanity check first
if (!/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+/.test(userInput)) {
  throw new Error('Enter a public GitHub repository URL.');
}
await previewImport(userInput);
Defensive patterns

Strategy: validation

Validate before calling

const GITHUB_URL = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+/;
if (!GITHUB_URL.test(input.trim())) {
  setError('Enter a GitHub repository URL, e.g. https://github.com/owner/repo');
  return;
}

Type guard

function isGitHubRepoUrl(v: unknown): v is string {
  return typeof v === 'string' && /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+/.test(v);
}

Try / catch

try {
  const next = await previewImport(url);
  setPreview(next);
} catch (e) {
  const msg = e instanceof Error ? e.message : String(e);
  toast(/429|502/.test(msg)
    ? 'GitHub is rate-limiting the import. Try again in a few minutes.'
    : /404|403/.test(msg)
      ? 'Repository not found or private. Use a public repo.'
      : msg);
}

Prevention

When it happens

Trigger: POST with a normalized GitHub URL returns 4xx/5xx: malformed or non-GitHub URL (400), repo not found or private (404/403), GitHub rate limit on the server side (429/502), or repo too large to analyze (timeout within 20s).

Common situations: Pasting a private repo URL expecting import to work; pasting a gitlab/bitbucket URL; org's Den server IP rate-limited by GitHub during bulk imports; repo with no recognizable MCP components.

Related errors


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