
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThanks for the kind words about Sanity! Let me help you with both the export error and the dataset duplication question.
The MaxListenersExceededWarning and Read timeout error you're seeing is a known issue that occurs when exporting datasets with many assets (you have 590 assets). The error happens during the final "Adding assets to archive" step when the process times out after 180 seconds without receiving data.
Here are a few approaches to work around this:
Check if the export is actually usable: Sometimes the .tar.gz file is still valid despite the error. Try extracting it with tar -xzf your-export.tar.gz to see if it works. The documents and most assets may have been successfully archived before the timeout.
Export without assets first: You can export just the documents, then handle assets separately if needed:
sanity dataset export production production-docs.ndjson --no-assetsTry during off-peak hours: Network conditions and server load can affect large asset downloads, so timing might help with the timeout issue.
Update your CLI: Make sure you're on the latest version with npm install -g @sanity/cli as newer versions may have improved timeout handling.
Increase Node.js memory: The EventEmitter warnings suggest memory pressure. Try:
NODE_OPTIONS="--max-old-space-size=4096" sanity dataset export productionIf none of these work and you have an Enterprise plan, consider using Cloud Clone, which duplicates datasets server-side without needing to download locally.
When you successfully export a dataset as a .tar.gz archive, it contains:
assets.json fileassets/ folder with the actual asset filesThe sanity dataset import command handles assets automatically when you import the .tar.gz file:
sanity dataset import production.tar.gz developmentThis single command imports both the documents AND the assets - you don't need to do anything special or import them separately. The CLI takes care of uploading all the assets to the target dataset.
If you only have the NDJSON file (from an export with --no-assets), then only the document references will be imported, but the actual asset files won't be available in the new dataset.
For a complete dataset duplication:
# 1. Export everything (documents + assets)
sanity dataset export production production-backup.tar.gz
# 2. Create a new dataset (if it doesn't exist)
sanity dataset create development
# 3. Import everything into the new dataset
sanity dataset import production-backup.tar.gz developmentAlternatively, check out the Cross Dataset Duplicator plugin which lets you duplicate datasets directly from within Studio without using the CLI - super handy for content editors who aren't comfortable with command-line tools.
Hope this helps! If you're still hitting the timeout issue consistently, it might be worth reaching out to Sanity support as they may be able to help with large dataset exports or investigate if there's a deeper issue.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store