remotion-dev/remotion · error · Error

The GitHub URL must point to a repository, for example https

Error message

The GitHub URL must point to a repository, for example https://github.com/remotion-dev/template-audiogram.

What it means

After parsing, url.pathname must split into exactly two non-empty segments (owner and repo). URLs with one segment (a bare user profile), zero segments, or three or more (deep links such as /owner/repo/tree/main/src/index.ts) fail this check. The URL must point at the repository root, not at any file or subpage inside it.

Source

Thrown at packages/browser-studio/src/load-github-repository.ts:70

const maximumRepositoryBytes = 100 * 1024 * 1024;
const maximumRepositoryFiles = 2_000;
const downloadConcurrency = 8;

const parseGitHubRepositoryUrl = (repoUrl: string) => {
	let url: URL;
	try {
		url = new URL(repoUrl);
	} catch {
		throw new Error(`Invalid GitHub repository URL: ${repoUrl}`);
	}

	if (url.protocol !== 'https:' || url.hostname !== 'github.com') {
		throw new Error('The repo parameter must be an https://github.com URL.');
	}

	const pathSegments = url.pathname.split('/').filter(Boolean);
	if (pathSegments.length !== 2) {
		throw new Error(
			'The GitHub URL must point to a repository, for example https://github.com/remotion-dev/template-audiogram.',
		);
	}

	const owner = pathSegments[0];
	const repo = pathSegments[1].replace(/\.git$/, '');
	if (
		!owner ||
		!repo ||
		![owner, repo].every((part) => /^[a-zA-Z0-9_.-]+$/.test(part))
	) {
		throw new Error(`Invalid GitHub repository URL: ${repoUrl}`);
	}

	return {owner, repo};
};

const getResponseError = async (response: Response) => {

View on GitHub (pinned to 10db9de073)

Solutions

  1. Link to the repository root: https://github.com/owner/repo
  2. Strip suffixes like /tree/main, /blob/main/..., /issues, /pull from the URL
  3. Verify the URL has exactly two path segments: owner and repo name

Example fix

// before
await loadGitHubRepository({repoUrl: 'https://github.com/remotion-dev/template-audiogram/tree/main'});

// after
await loadGitHubRepository({repoUrl: 'https://github.com/remotion-dev/template-audiogram'});
Defensive patterns

Strategy: validation

Validate before calling

const {pathname} = new URL(repoUrl);
const segments = pathname.split('/').filter(Boolean);
if (segments.length !== 2) {
  throw new Error('Link to the repository root (owner/repo), not a file, tree, or subpage');
}

Type guard

const isRepoRootUrl = (value: string): value is `https://github.com/${string}/${string}` => {
  try {
    return new URL(value).pathname.split('/').filter(Boolean).length === 2;
  } catch {
    return false;
  }
};

Try / catch

try {
  await loadGitHubRepository({repoUrl});
} catch (e) {
  if (/must point to a repository/.test(String((e as Error).message))) {
    // truncate the pathname to owner/repo and retry
  } else throw e;
}

Prevention

When it happens

Trigger: Calling loadGitHubRepository with https://github.com/owner (profile page), https://github.com/ (root), https://github.com/owner/repo/tree/main, https://github.com/owner/repo/blob/main/src/index.ts, or /owner/repo/issues/123.

Common situations: Copying a deep URL from GitHub's file browser or address bar while browsing code, or linking an issues/pulls page instead of the repo landing page.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/44b2ab0498745bec. Report an issue: GitHub.