Importing dataset stuck at 99%, CLI may appear stuck but should be left to run its course.
I feel your pain! Getting stuck at 99% after nearly 4 hours is incredibly frustrating. The good news is that yes, asset imports do have significant post-processing that can take a long time, especially with large datasets.
Based on the Sanity migration documentation, asset uploads are particularly resource-intensive and can cause bottlenecks. Here's what's likely happening:
Why it's stuck at 99%:
Asset processing - Each asset needs to be uploaded, processed, and have metadata extracted. Images get analyzed, optimized, and potentially have multiple versions generated.
Transaction batching - Sanity batches mutations into transactions to avoid rate limits. If you have thousands of assets, the final batch might be substantial and take time to commit.
Validation - The system validates all documents against your schema, which happens toward the end of the import process.
What you should do:
Don't panic and don't kill the process yet - That 99% likely represents the bulk data transfer, and the remaining 1% is the post-processing/validation phase. This can legitimately take a long time with many assets.
Check your network/console - Look for any activity in your browser console or terminal. If you're still seeing network requests or processing logs, it's working.
Monitor your dataset - Open your Sanity Studio in another tab and check if assets are appearing. You can query your dataset to see if documents are being created.
For future imports:
The documentation recommends using concurrent uploads with rate limiting (using tools like p-limit) rather than sequential processing, which dramatically improves performance. If you're using a custom script, implementing proper concurrency control can reduce hours-long imports to minutes.
If this import does fail, the good news is that migration scripts should be idempotent - meaning you can re-run them safely using deterministic IDs without creating duplicates. This is a core principle in Sanity's migration approach.
Hang in there - that last 1% is often the longest!
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.