๐Ÿ˜Ž Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Import: Asset file does not exist

This error usually occurs when you are importing documents using sanity dataset import ... and images or files (also known as assets) aren't found.

This typically happens if a file isn't at the given path on your local system or the asset URL returns 404.

The solution is to ensure that each path and URL actually points to a file. Note that local file paths must be absolute, not relative:

Correct: image@file:///local/path/to/rogue-one-poster.jpg

Wrong: image@file://../../local/path/to/rogue-one-poster.jpg

Sometimes it's ok if not all assets are imported successfully. E.g. you're fetching tons of cat gifs off the Internet and some of them are bound to not exist. If you can live with that, use the --allow-failing-assets flag when running your import command.

You can read more about importing data here.

Was this article helpful?