Import: Asset has different target than source
The sanity dataset import command stops with one of these two errors:
Asset ASSET_ID references a different project ID than the specified target (asset is in PROJECT_ID, importing to TARGET_PROJECT_ID).Asset ASSET_ID references a different dataset than the specified target (asset is in DATASET, importing to TARGET_DATASET).
This usually happens when you exported a dataset with sanity dataset export --raw, then imported it to a different project ID or dataset name. The uppercase names are placeholders for the values in your own output.
This fails because the imported documents would refer to assets outside their own dataset, which is usually not what you want. If you delete an asset from the source dataset, it would create a "loose" asset document in the target dataset, which points to a file that no longer exists.
The solution is to not use --raw when exporting, which will also export all the assets from the source dataset. This will make sure the assets are also present in the target dataset when importing.
In very rare cases, you may want to allow the assets to reference URLs from a different dataset, in which case you can use the --allow-assets-in-different-dataset flag when importing.