{"record":{"id":"f417b57905779436","repo":"remix-run/react-router","slug":"there-was-a-problem-extracting-the-file-from-the-p-f417b5","errorCode":null,"errorMessage":"There was a problem extracting the file from the provided template.  Template URL: `${tarballUrl}`  Destination directory: `${downloadPath}`","messagePattern":"There was a problem extracting the file from the provided template\\.  Template URL: `(.+?)`  Destination directory: `(.+?)`","errorType":"exception","errorClass":"CopyTemplateError","httpStatus":null,"severity":"error","filePath":"packages/create-react-router/copy-template.ts","lineNumber":332,"sourceCode":"              filePathHasFiles = true;\n              header.name = header.name.replace(filePath, \"\");\n            } else {\n              header.name = \"__IGNORE__\";\n            }\n          }\n\n          return header;\n        },\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,","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/remix-run/react-router/blob/6beaca39526d5716c3c112ebb0782765baa5a9ce/packages/create-react-router/copy-template.ts#L314-L350","documentation":"After a successful HTTP 200 download, the gzip/tar extraction pipeline threw while streaming the response body into the destination. The body was not a valid gzipped tarball: an HTML error page served under a 200 (SPA catch-all hosting), a tarball compressed with something other than gzip (zstd/xz), or a stream interrupted mid-transfer.","triggerScenarios":"A template URL on a static host with a catch-all route returning index.html for unknown paths; proxy/MITM mangling the body; network reset during streaming; archives packed with non-gzip compression renamed to .tar.gz.","commonSituations":"Self-hosted template tarballs behind SPA rewrites; corporate proxies corrupting binary transfers; flaky CI networks truncating downloads.","solutions":["Verify the URL serves real gzip data: curl -sL <url> | file - should report 'gzip compressed data'","Re-pack the archive as gzip-compressed tar and re-host it","If behind a proxy, bypass it or configure it correctly, then retry","Re-run with --debug to see which stream stage failed"],"exampleFix":"# before: SPA host serves index.html for the tarball path\nnpx create-react-router my-app --template https://tpl.example.com/template.tar.gz\n\n# after: confirm and fix hosting so the URL serves gzip\ncurl -sL https://tpl.example.com/template.tar.gz | file -\n# -> 'gzip compressed data' (not HTML document)","handlingStrategy":"try-catch","validationCode":"async function urlServesGzipTarball(url: string): Promise<boolean> {\n  const res = await fetch(url);\n  if (!res.ok) return false;\n  const buf = Buffer.from(await res.arrayBuffer());\n  // gzip magic number 0x1f 0x8b\n  return buf.length > 2 && buf[0] === 0x1f && buf[1] === 0x8b;\n}\n\nif (!(await urlServesGzipTarball(templateUrl))) {\n  throw new Error(\"Template URL does not serve gzip data (check hosting/catch-all routes)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  await copyTemplate(templateUrl, dest, { onError: (e) => { throw e; } });\n} catch (e) {\n  if (e instanceof CopyTemplateError && /problem extracting the file from the provided template/.test(e.message)\n      && /Template URL:/.test(e.message)) {\n    console.error(\"Downloaded body was not a valid gzipped tarball — verify the URL with curl.\");\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Smoke-test template URLs with curl -sL <url> | file - before wiring them into scripts","Disable SPA catch-all rewrites for .tar.gz paths on static hosts","Create archives with gzip compression only (tar -czf), not zstd or xz"],"tags":["network","tarball","extraction","cli"],"backgroundTag":"archive-extraction-failed","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"}