Importing dataset stuck at 99%, CLI may appear stuck but should be left to run its course.

12 replies
Last updated: Nov 24, 2022
This is killing me. I’m importing a dataset that has a LOT of assets. It’s been stuck on 99% for an hour and I’m scared it’s failed with 1% left (after 3hrs 40mins getting up to 99%)
Does importing assets have a long “post process” task does anyone know?
AI Update

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

  1. Asset processing - Each asset needs to be uploaded, processed, and have metadata extracted. Images get analyzed, optimized, and potentially have multiple versions generated.

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

  3. 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!

20mins to export the dataset and currently 5hrs+ (incomplete) importing
Did a job ID post at the start of the process? I can take a look.
It didn’t no 😞 this is all I got
Okay, no problem.
Although these exports can be nail-biting, my understanding is that they’re still working as long as you don’t get an error. I also believe that the percentages might align with steps rather than overall process, so it’s not unusual to get something like this that’s “stuck” on 99%.
Yeah, I knew this was going to be a long slog (btw, this isn’t Unilever
user A
, otherwise I’d have done a clone with no history… unfortunately this client isn’t on a business level account 😢 )
No problem!
Do you want to DM me the project ID? I might be able to track it that way.
Received. Thanks User.
Looks like it may have finished but the CLI is hung up. Would you mind checking in Manage?
The dataset is in manage now
does that mean it’s fully complete if it’s there?
Yes, appearing in Manage should be the final step of the import process. It shouldn’t appear there until the import is complete. Corrected below.
Following up on this thread to correct myself and also add better notes for anyone who comes across it.
For an export/import, the dataset appearing in Manage is
not the final step in the process. The CLI will sometimes disconnect from the import job—particularly on long imports with a lot of assets that take several hours. Even if the CLI appears stuck, it’s encouraged to let it run its course. Once the job is done, the CLI should provide an indication as such.
In the meantime, the imported dataset may appear in Manage and be accessible in the Studio. However, there may be oddities like missing assets and weak references. At the end of the import job, all assets will be available and references will be strengthened.

If the CLI job is killed before this is complete, it’s recommended to run the import job again using the
--replace
flag.

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?