remotion-dev/remotion · error · Error
Could not read ${owner}/${repo}: ${tree.message ?? 'GitHub r
Error message
Could not read ${owner}/${repo}: ${tree.message ?? 'GitHub returned an invalid file tree.'} What it means
The GitHub trees API returned 2xx but the JSON body lacked tree.tree or tree.sha, so the response shape is unusable. This happens for repositories with no commits (HEAD has no tree yet), API-level message payloads, or unexpected/invalid responses. GitHub's message field is included when present; otherwise a generic 'invalid file tree' text is used.
Source
Thrown at packages/browser-studio/src/load-github-repository.ts:155
repoUrl: string;
signal?: AbortSignal;
}): Promise<VirtualProject> => {
const {owner, repo} = parseGitHubRepositoryUrl(repoUrl);
onProgress?.({phase: 'reading-repository'});
const treeResponse = await fetch(
`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/git/trees/HEAD?recursive=1`,
{signal},
);
if (!treeResponse.ok) {
throw new Error(
`Could not read ${owner}/${repo}: ${await getResponseError(treeResponse)}`,
);
}
const tree = (await treeResponse.json()) as GitHubTreeResponse;
if (!tree.tree || !tree.sha) {
throw new Error(
`Could not read ${owner}/${repo}: ${tree.message ?? 'GitHub returned an invalid file tree.'}`,
);
}
const treeSha = tree.sha;
if (tree.truncated) {
throw new Error(
`${owner}/${repo} has too many files for Browser Studio to load.`,
);
}
const fileEntries = tree.tree.filter(
(entry): entry is GitHubTreeEntry & {type: 'blob'} => entry.type === 'blob',
);
for (const file of fileEntries) {
validateRepositoryPath(file.path);
}View on GitHub (pinned to 10db9de073)
Solutions
- Verify the repository has at least one commit (an empty repo cannot be loaded)
- Push an initial commit and retry
- Retry later for transient API responses; check githubstatus.com if it persists
Defensive patterns
Strategy: try-catch
Try / catch
try {
await loadGitHubRepository({repoUrl});
} catch (e) {
const msg = String((e as Error).message);
if (/invalid file tree/.test(msg) || msg.includes('Git Repository is empty')) {
// ask the user to push at least one commit, then retry
} else throw e;
} Prevention
- Only share Browser Studio links to repositories that contain at least one commit
- Retry once - GitHub occasionally returns partial API responses
- Check githubstatus.com when invalid-tree errors persist across different repos
When it happens
Trigger: Calling loadGitHubRepository on a freshly created, completely empty repository (initialized with no README/commit); a GitHub API change or partial response; an intermediary (proxy/captive portal) returning 200 with non-GitHub JSON.
Common situations: Users pasting a link to a repo they just created but never pushed to; intermittent API weirdness during incidents; corporate proxies that intercept api.github.com.
Related errors
- Could not read ${owner}/${repo}: ${await getResponseError(tr
- Invalid GitHub repository URL: ${repoUrl}
- The repo parameter must be an https://github.com URL.
- The GitHub URL must point to a repository, for example https
- The repository contains an unsupported path: ${path}
AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22).
Data as JSON: /api/errors/5011091df7dd23ef.
Report an issue: GitHub.