🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Error uploading images to Sanity Studio due to incorrect metadata options

10 replies
Last updated: Dec 22, 2021
Hello. I just tried uploading a few images locally and on my hosted Sanity Studio, however every time I do I am receiving the following error:
Upload failed
The upload could not be completed at this time
I checked the Sanity Status page and looks like everything is OK.
Dec 22, 2021, 3:43 PM
Hi Brent. Is there any additional information in the console?
Dec 22, 2021, 6:54 PM
Hi
user A
, sorry I forgot to add that to the original message.
{
    "response": {
        "body": {
            "statusCode": 400,
            "error": "Bad Request",
            "message": "child \"meta\" fails because [\"meta\" at position 0 fails because [\"0\" must be one of [location, exif, image, palette, lqip, blurhash, none]]]",
            "validation": {
                "source": "query",
                "keys": [
                    "meta.0"
                ]
            }
        },
        "url": "<https://xxxxxx.api.sanity.io/v1/assets/images/production?tag=sanity.studio.asset.upload&filename=brooke-cagle-Uduc5hJX2Ew-unsplash.jpg&meta=dimensions&meta=location&meta=exif>",
        "method": "POST",
        "headers": {
            "content-length": "248",
            "content-type": "application/json; charset=utf-8",
            "etag": "W/\"f8-CqKInPwEck24vFlC5Ogq0g/OQBQ\""
        },
        "statusCode": 400,
        "statusMessage": ""
    },
    "statusCode": 400,
    "responseBody": "{\n  \"statusCode\": 400,\n  \"error\": \"Bad Request\",\n  \"message\": \"child \\\"meta\\\" fails because [\\\"meta\\\" at position 0 fails because [\\\"0\\\" must be one of [location, exif, image, palette, lqip, blurhash, none]]]\",\n  \"validation\": {\n    \"source\": \"query\",\n    \"keys\": [\n      \"meta.0\"\n    ]\n  }\n}"
}
To me it looks like a possible issue with my options.metadata array:

options: {
    metadata: ['dimensions', 'location', 'exif'],
 },
Dec 22, 2021, 8:28 PM
It was ‘dimensions’… 🙄
Dec 22, 2021, 8:41 PM
Ahh, good find! Glad you got things working. 🙌
Dec 22, 2021, 8:43 PM
Haha yea, I knew that was a default but I guess I didn’t think it would cause it to break if I included. Oh well. Lesson learned. Thanks for your quick response/help. Have a great day!
Dec 22, 2021, 8:45 PM
Somewhere in our docs I seem to recall seeing all of the metadata options listed. I’ll need to track that down and ensure it’s correct. Appreciate you bringing this up. Have a great day as well!
Dec 22, 2021, 8:47 PM
Ahh, right at the top here . I’ll make sure this is correct or corrected.
Dec 22, 2021, 8:48 PM
Thank you! Yea that’s where I found it originally too.
Dec 22, 2021, 8:49 PM
I guess the added message could be added / updated to “Always included” something about not including it…
Dec 22, 2021, 8:50 PM
since it’s always included
Dec 22, 2021, 8:50 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?