{"record":{"id":"afe56b50272aee00","repo":"remix-run/react-router","slug":"there-was-a-problem-extracting-the-file-from-the-p","errorCode":null,"errorMessage":"There was a problem extracting the file from the provided template.  Template filepath: `${tarballPath}`  Destination directory: `${destPath}`  ${error}","messagePattern":"There was a problem extracting the file from the provided template\\.  Template filepath: `(.+?)`  Destination directory: `(.+?)`  (.+?)","errorType":"exception","errorClass":"CopyTemplateError","httpStatus":null,"severity":"error","filePath":"packages/create-react-router/copy-template.ts","lineNumber":157,"sourceCode":"  throw new CopyTemplateError(\n    \"The provided template is not a valid local directory or tarball.\",\n  );\n}\n\nconst pipeline = promisify(stream.pipeline);\n\nasync function extractLocalTarball(\n  tarballPath: string,\n  destPath: string,\n): Promise<void> {\n  try {\n    await pipeline(\n      fs.createReadStream(tarballPath),\n      gunzip(),\n      tar.extract(destPath, { strip: 1 }),\n    );\n  } catch (error: unknown) {\n    throw new CopyTemplateError(\n      \"There was a problem extracting the file from the provided template.\" +\n        `  Template filepath: \\`${tarballPath}\\`` +\n        `  Destination directory: \\`${destPath}\\`` +\n        `  ${error}`,\n    );\n  }\n}\n\ninterface TarballDownloadOptions {\n  debug?: boolean;\n  filePath?: string | null;\n  token?: string;\n}\n\nasync function downloadAndExtractRepoTarball(\n  repo: RepoInfo,\n  destPath: string,\n  options: TarballDownloadOptions,","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/remix-run/react-router/blob/1fd704a7dabcbe3ae09d7387b460e6acaba30ec1/packages/create-react-router/copy-template.ts#L139-L175","documentation":"Thrown by extractLocalTarball() when the gunzip/tar-fs stream pipeline rejects while reading a local .tar.gz/.tgz file. The pipeline is fs.createReadStream -> gunzip-maybe -> tar.extract(dest, { strip: 1 }); a failure anywhere (corrupt gzip, truncated file, bad tar header, unreadable path, permissions) is caught and re-wrapped as a CopyTemplateError that includes the tarballPath, destPath, and the underlying error.","triggerScenarios":"A .tar.gz file that is actually a .zip renamed, a partially-downloaded/truncated tarball, an empty file, gzip data with a corrupt member, a tar entry with paths that cannot be written to destPath, or EBADF/EACCES reading the source or writing the destination.","commonSituations":"Tarball download was interrupted; file was committed to git with LF/CRLF mangling that corrupts binary data; the file is a different archive format (zip, 7z) with a .tar.gz extension; destPath is on a read-only mount; antivirus locking the file on Windows.","solutions":["Re-download or regenerate the tarball and verify integrity: tar -tzf <file> should list contents without error.","Confirm the file is genuinely gzip+tar and not another format: file <path> (should report 'gzip compressed data').","Check filesystem permissions on both the tarball (read) and the destination (write).","If the archive is .zip, extract it and pass the directory instead, or repackage as tar.gz.","Inspect the appended underlying error string for the exact syscall/errno and address that."],"exampleFix":"// before -- template.tar.gz is corrupt\ncreate-react-router my-app --template ./template.tar.gz\n// after -- verify, then repackage\ntar -tzf ./template.tar.gz || (rm ./template.tar.gz && curl -L -o ./template.tar.gz <url>)\ncreate-react-router my-app --template ./template.tar.gz","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\nfunction tarballLooksValid(file: string): boolean {\n  try {\n    execSync(`tar -tzf \"${file}\" > /dev/null 2>&1`, { stdio: 'ignore' });\n    return true;\n  } catch { return false; }\n}\n// if (!tarballLooksValid(template)) redownload before invoking the CLI","typeGuard":null,"tryCatchPattern":"try {\n  await copyTemplate(localTarball, dest, { onError: async (e) => { throw e; } });\n} catch (e) {\n  if (e instanceof CopyTemplateError && /problem extracting/.test(e.message)) {\n    // redownload / regenerate tarball, then retry once\n  } else throw e;\n}","preventionTips":["Verify tarballs with `tar -tzf <file>` before referencing them.","Use `file <path>` to confirm gzip content type.","Re-download interrupted archives rather than reusing them.","Generate tarballs with `tar -czf` from a known-good directory."],"tags":["cli","template","tarball","filesystem","create-react-router"],"backgroundTag":null,"analyzedSha":"1fd704a7dabcbe3ae09d7387b460e6acaba30ec1","analyzedAt":"2026-08-12T13:54:57.804Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}