šŸ—“ļø Everything *[NYC] is back. A free gathering for AI builders. Sept 9 →

Sanity dataset export hangs on "Adding assets to archive" step

34 repliesLast updated: Dec 1, 2025

Hi chaps, is it normal that
npx sanity dataset export <mydatasetname> --raw - >file.tar.gz
should run forever, hanging (bizarrely) on the
Adding assets to archive...
step?
AI Update

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.gz

The 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:

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 thread
34 replies

Was this answer helpful?

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.

Related contributions