Help articles

Import fails: asset URL does not exist

An asset document in your import file points to a URL that returns 404. Skip URL verification to finish the import, or fix the asset URLs.

This error occurs when you run sanity datasets import and the import file contains an asset document (sanity.imageAsset or sanity.fileAsset) whose url field returns HTTP 404. The import stops at the Validating asset documents step and reports:

Document DOCUMENT_ID points to a URL that does not exist (ASSET_URL)

DOCUMENT_ID is the asset document's ID and ASSET_URL is the URL it points to. Every asset document in the file is checked with an HTTP HEAD request before any documents are imported, so one dead URL stops the whole import.

This usually means the assets were deleted from the source dataset after the export was taken. If an asset document points at a different project or dataset instead, the import fails with a different error: see Import: Asset has different target than source.

Import without verifying asset URLs

To finish the import anyway, pass --allow-failing-assets. The flag turns off URL verification for every asset document in the file, not only the failing one, so asset documents with dead URLs are imported with those URLs intact. Download and upload failures are then reported as warnings at the end of the run instead of stopping the import.

Check local asset file paths

Assets referenced from your own machine with _sanityAsset and a file:// URL take a different code path. A missing file there fails with a message starting Failed to download rather than the points to a URL that does not exist message. If that is what you see, check the path form:

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

Relative to the import file: image@file://./images/rogue-one-poster.jpg. These resolve against the directory of the ndjson file or folder you passed to the import command.

Parent-directory traversal is not supported. image@file://../../images/rogue-one-poster.jpg is read as a hostname rather than a path and fails with ERR_INVALID_FILE_URL_HOST.

For the full import format, including the _sanityAsset syntax, see Importing data.

Was this page helpful?