{"record":{"id":"72e18e91e6ac8d4d","repo":"remix-run/react-router","slug":"the-path-filepath-was-not-found-in-this-isg","errorCode":null,"errorMessage":"The path \"${filePath}\" was not found in this ${isGithubUrl ? \"GitHub repo.\" : \"tarball.\"}","messagePattern":"The path \"(.+?)\" was not found in this (.+?)","errorType":"exception","errorClass":"CopyTemplateError","httpStatus":null,"severity":"error","filePath":"packages/create-react-router/copy-template.ts","lineNumber":340,"sourceCode":"        },\n        ignore(_filename, header) {\n          if (!header) {\n            throw Error(\"Header is undefined\");\n          }\n          return header.name === \"__IGNORE__\";\n        },\n      }),\n    );\n  } catch {\n    throw new CopyTemplateError(\n      \"There was a problem extracting the file from the provided template.\" +\n        `  Template URL: \\`${tarballUrl}\\`` +\n        `  Destination directory: \\`${downloadPath}\\``,\n    );\n  }\n\n  if (filePath && !filePathHasFiles) {\n    throw new CopyTemplateError(\n      `The path \"${filePath}\" was not found in this ${\n        isGithubUrl ? \"GitHub repo.\" : \"tarball.\"\n      }`,\n    );\n  }\n}\n\n// Copied from react-router-node/stream.ts\nasync function writeReadableStreamToWritable(\n  stream: ReadableStream,\n  writable: stream.Writable,\n) {\n  let reader = stream.getReader();\n  let flushable = writable as { flush?: Function };\n\n  try {\n    while (true) {\n      let { done, value } = await reader.read();","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/remix-run/react-router/blob/6beaca39526d5716c3c112ebb0782765baa5a9ce/packages/create-react-router/copy-template.ts#L322-L358","documentation":"The template targeted a subdirectory (via :owner/:repo/:directory shorthand or a https://github.com/:owner/:repo/tree/:branch/:directory URL), so the tar-stream filter only kept entries under that path — and matched nothing, meaning filePathHasFiles stayed false. That directory does not exist in the repo/branch as spelled (matching is case-sensitive).","triggerScenarios":"Directory renamed or removed in the template repo; wrong branch in the /tree/ URL; wrong case ('Templates' vs 'templates'); shorthand path segments not matching the repo layout (e.g. pointing at a file instead of a directory).","commonSituations":"Following an outdated README example after the repo restructured; template repos moving example folders between branches; case-sensitivity differences between macOS/Windows development and Linux CI.","solutions":["Browse the repo on GitHub and copy the current /tree/:branch/:directory URL exactly","Check spelling and case of every path segment","If using :owner/:repo/:directory shorthand, try the full URL form instead so the branch is explicit"],"exampleFix":"# before: directory renamed in the repo\nnpx create-react-router my-app --template remix-run/react-router/templates/basic\n\n# after: confirm the path exists, use current location\nnpx create-react-router my-app \\\n  --template https://github.com/remix-run/react-router-templates/tree/main/default","handlingStrategy":"validation","validationCode":"async function repoDirectoryExists(owner: string, repo: string, branch: string, dir: string, token?: string) {\n  const headers: Record<string, string> = {};\n  if (token) headers.Authorization = `token ${token}`;\n  const res = await fetch(\n    `https://api.github.com/repos/${owner}/${repo}/contents/${dir}?ref=${branch}`,\n    { headers },\n  );\n  return res.status === 200;\n}\n\nif (!(await repoDirectoryExists(\"acme\", \"tpl\", \"main\", \"templates/default\"))) {\n  throw new Error(\"Template directory not found — check case and branch\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createReactRouter(args);\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e);\n  const m = msg.match(/The path \"([^\"]+)\" was not found/);\n  if (m) {\n    console.error(`Directory ${m[1]} absent in that repo/branch — verify case and branch on GitHub.`);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Pin template URLs to an explicit branch and directory copied from the GitHub UI","Remember directory matching is case-sensitive even on case-insensitive filesystems","Subscribe to releases of template repos you depend on so restructures are visible early"],"tags":["github","template","path","cli"],"backgroundTag":"file-not-found","analyzedSha":"6beaca39526d5716c3c112ebb0782765baa5a9ce","analyzedAt":"2026-08-18T18:04:14.938Z","contentChangedAt":"2026-08-18T18:04:14.938Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}