remix-run/react-router · error · CopyTemplateError

The path "${filePath}" was not found in this ${isGithubUrl ?

Error message

The path "${filePath}" was not found in this ${isGithubUrl ? "GitHub repo." : "tarball."}

What it means

Thrown after a successful download+extract when a filePath (subdirectory) was requested but no tar entries matched it — filePathHasFiles stayed false. The filePath is set when you use owner/repo/subdir shorthand or a /tree/:branch/:dir URL; the map() hook marks entries '__IGNORE__' unless their name starts with filePath, and if none ever matched, the requested subdirectory does not exist in the archive.

Source

Thrown at packages/create-react-router/copy-template.ts:340

        },
        ignore(_filename, header) {
          if (!header) {
            throw Error("Header is undefined");
          }
          return header.name === "__IGNORE__";
        },
      }),
    );
  } catch {
    throw new CopyTemplateError(
      "There was a problem extracting the file from the provided template." +
        `  Template URL: \`${tarballUrl}\`` +
        `  Destination directory: \`${downloadPath}\``,
    );
  }

  if (filePath && !filePathHasFiles) {
    throw new CopyTemplateError(
      `The path "${filePath}" was not found in this ${
        isGithubUrl ? "GitHub repo." : "tarball."
      }`,
    );
  }
}

// Copied from react-router-node/stream.ts
async function writeReadableStreamToWritable(
  stream: ReadableStream,
  writable: stream.Writable,
) {
  let reader = stream.getReader();
  let flushable = writable as { flush?: Function };

  try {
    while (true) {
      let { done, value } = await reader.read();

View on GitHub (pinned to 1fd704a7da)

Solutions

  1. Browse the repo at the resolved branch and copy the exact directory path (case-sensitive).
  2. If using /tree/:branch/:dir, confirm :branch exists and contains the directory.
  3. Try the owner/repo shorthand with a verified subdirectory: --template remix-run/react-router/<verified-dir>.
  4. Omit the subdirectory to pull the whole repo, then move the desired folder out manually.

Example fix

// before -- subdir renamed upstream
create-react-router my-app --template https://github.com/remix-run/react-router-templates/tree/main/old-name
// after -- verify the path on GitHub and use the current name
create-react-router my-app --template https://github.com/remix-run/react-router-templates/tree/main/default
Defensive patterns

Strategy: validation

Validate before calling

// Confirm a subdirectory exists in the repo's default branch via the contents API
async function subdirExists(owner: string, repo: string, branch: string, dir: string, token?: string) {
  const url = `https://api.github.com/repos/${owner}/${repo}/contents/${dir}?ref=${branch}`;
  const h: HeadersInit = { Accept: 'application/vnd.github.v3+json' };
  if (token) h.Authorization = `token ${token}`;
  const r = await fetch(url, { headers: h });
  if (!r.ok) return false;
  const body = await r.json();
  return Array.isArray(body);
}

Prevention

When it happens

Trigger: --template remix-run/react-router/templates/not-a-real-dir; a /tree/main/examples/missing URL; the directory was renamed since the URL was copied; case mismatch in the path (Templates vs templates); the path exists only on a different branch than the one resolved.

Common situations: Template path copied from old docs after upstream restructure; using a branch where the subdir does not exist; typo in the nested path segment; expecting a directory but the path is actually a single file.

Related errors


AI-assisted analysis of remix-run/react-router@1fd704a7da (2026-08-12). Data as JSON: /api/errors/72e18e91e6ac8d4d. Report an issue: GitHub.