mastra-ai/mastra · error · Error

Only github.com plugin URLs are supported

Error message

Only github.com plugin URLs are supported

What it means

The URL parsed successfully but its hostname is not exactly 'github.com'. The V1 plugin installer only supports public github.com repositories (it shells out to the gh CLI against github.com), so any other host is rejected outright.

Source

Thrown at mastracode/sdk/src/plugins/install.ts:238

  } catch {
    throw new Error('GitHub CLI is not authenticated. Run gh auth login, then install the plugin again.');
  }
}

function parseGithubUrl(specifier: string): { owner: string; repo: string; repoSpec: string; ref?: string } {
  const [urlPart, ref] = specifier.split('#', 2);
  if (!urlPart) {
    throw new Error(`Invalid GitHub URL: ${specifier}`);
  }
  let url: URL;
  try {
    url = new URL(urlPart);
  } catch {
    throw new Error(`Invalid GitHub URL: ${specifier}`);
  }

  if (url.hostname !== 'github.com') {
    throw new Error('Only github.com plugin URLs are supported');
  }

  const [owner, rawRepo, ...rest] = url.pathname.split('/').filter(Boolean);
  if (!owner || !rawRepo || rest.length > 0) {
    throw new Error('GitHub plugin URL must be in the form https://github.com/owner/repo');
  }

  const repo = rawRepo.replace(/\.git$/, '');
  if (!/^[A-Za-z0-9_.-]+$/.test(owner) || !/^[A-Za-z0-9_.-]+$/.test(repo)) {
    throw new Error('GitHub owner and repo may only contain letters, numbers, dots, underscores, and dashes');
  }

  return {
    owner,
    repo,
    repoSpec: `${owner}/${repo}`,
    ...(ref ? { ref } : {}),
  };

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use a repository hosted on github.com; mirror the plugin repo there if it currently lives on another host.
  2. Fix hostname typos so it reads exactly 'github.com' (subdomains like 'www.github.com' also fail).
  3. If the code must target GitHub Enterprise, fork/extend parseGithubUrl rather than passing the GHES URL.

Example fix

// before
await installPlugin('https://github.mycompany.com/acme/widgets'); // GHES host
// after
await installPlugin('https://github.com/acme/widgets');
Defensive patterns

Strategy: validation

Validate before calling

function isGithubComUrl(specifier: string): boolean {
  try {
    return new URL(specifier.split('#')[0]).hostname === 'github.com';
  } catch {
    return false;
  }
}

Try / catch

try {
  await installPlugin(specifier);
} catch (error) {
  if (error instanceof Error && error.message === 'Only github.com plugin URLs are supported') {
    throw new Error(`Plugin installs require github.com; "${specifier}" points elsewhere (GHES/GitLab unsupported)`);
  }
  throw error;
}

Prevention

When it happens

Trigger: Installing from 'https://gitlab.com/owner/repo', a GitHub Enterprise host like 'https://github.mycompany.com/owner/repo', or a typo'd host such as 'https://gihub.com/owner/repo'.

Common situations: Corporate environments that mirror repos on GHES or GitLab; using a redirect/shortener host; typos in the hostname.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/39d57dff81ef4ce2. Report an issue: GitHub.