Sanity dataset export hangs on "Adding assets to archive" step
I understand the frustration! The "Adding assets to archive..." step taking a very long time or appearing to hang is something that can happen with dataset exports, though it's not always clear whether it's actually hanging or just processing slowly.
From the official dataset export documentation, the standard usage is to specify the output file directly:
# Recommended approach
npx sanity dataset export <mydatasetname> file.tar.gzThe syntax you're using (--raw - > file.tar.gz) with piping to stdout isn't documented as the standard way to export datasets. The typical export workflow documented by Sanity involves specifying the output file directly rather than piping output.
Here's what I'd recommend trying:
Use the standard export syntax (most reliable):
npx sanity dataset export <mydatasetname> file.tar.gzThis is the documented approach and should work more predictably.
If you only need document data without assets:
npx sanity dataset export <mydatasetname> file.ndjson --no-assetsThis skips asset processing entirely and exports just your documents in NDJSON format, which is much faster.
Be patient with large asset collections: If your dataset has many or large assets, the "Adding assets to archive..." step can genuinely take a very long time (potentially hours). According to the documentation on export issues, exports of large datasets can experience timeouts but may still complete successfully.
If the standard export command also appears to hang on the asset step for an unreasonable amount of time (more than an hour for moderate-sized datasets), you might be hitting resource limits or network issues. In that case, you could try exporting without assets first to get your documents, then handle assets separately if needed.
The key takeaway: stick with the documented export syntax rather than using --raw with piping, as that's not the standard workflow and may behave unpredictably.
Show original thread34 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.