ECONNRESET error when downloading assets during dataset export

7 replies
Last updated: Jun 9, 2023
Hi, I'm running
sanity dataset export
but I'm constantly getting
ECONNRESET
when downloading assets today.
I have run that command successfully in the past.

Any ideas?


βœ” Exporting documents... (15285/15285)
β ‹ Downloading assets... (1561/2913)Error: aborted
    at connResetException (node:internal/errors:705:14)
    at TLSSocket.socketCloseListener (node:_http_client:454:19)
    at TLSSocket.emit (node:events:525:35)
    at node:net:301:12
    at TCP.done (node:_tls_wrap:588:7) {
  code: 'ECONNRESET'
}
AI Update

I feel your pain – ECONNRESET errors during asset downloads are frustrating, especially when the export was working fine before! This is typically a network or connection issue when downloading assets from Sanity's CDN. Here are several solutions to try:

Quick Fix: Reduce Asset Concurrency

The most common solution is to reduce the number of concurrent asset downloads. The CLI has an --asset-concurrency flag for this:

sanity dataset export production --asset-concurrency 5

The default is 12 concurrent downloads, which can overwhelm your connection or hit rate limits. Try starting with 5 and adjust up or down based on what works for your network.

Other Solutions to Try

1. Export without assets first, then retry

# Export documents only (fast)
sanity dataset export production production-docs.ndjson --no-assets

# Then export with assets and lower concurrency
sanity dataset export production production-full.tar.gz --asset-concurrency 3

2. Check your Node.js version

ECONNRESET errors with TLS connections can sometimes be Node.js version-related. Make sure you're running a stable LTS version (Node 20+ is required for newer Sanity tooling). Try updating if you're on an older version:

node --version

3. Network/firewall issues

  • Try from a different network (mobile hotspot, different WiFi)
  • Check if your firewall or VPN is interfering with long-running downloads
  • Corporate networks sometimes have aggressive connection timeouts

4. Retry during off-peak hours

If Sanity's CDN is experiencing high load, you might have better luck at different times of day.

5. Check Sanity's status

Visit status.sanity.io to see if there are any ongoing issues with asset delivery or the CDN.

If Nothing Works

For very large datasets, you might need to:

  • Contact Sanity support – they can sometimes help with large exports
  • Consider using the Export API directly with custom retry logic
  • If you're on an Enterprise plan, look into Cloud Clone which handles dataset copying server-side without downloading locally

The --asset-concurrency flag is usually the magic fix though – start there!

Show original thread
7 replies
About how long does the export run before this happens?
Around 30-45 minutes I'd say
What version of the CLI are you running?
Also to speed up the process, it may help to play around with the
--asset-concurrency <num>
flag when you run the command.
I was on
3.9.0
and node 16. I upgraded to
3.12.0
and node 18. It's working now, I'm not sure if it's a coincidence or not but I'll take it! πŸ˜„
And thanks for the tip on concurrency, I'll try that
Glad it started working

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.

Was this answer helpful?