Problem with collections images

Good afternoon, community

I am encountering an issue when attempting to update the image of the collections. I am receiving the following result:

{'collectionUpdate': {'collection': None, 'userErrors': [{'field': ['image'], 'message': '{:src=>"Error updating collection with this image"}'}]}}

The JSONL object is as follows:

{"input": {"title": "test-title", "handle": "test-handle", "descriptionHtml": "test-html", "id": "gid://shopify/Collection/435910377695", "image": {"altText": "test-alt-text", "src": "<url>"}, "sortOrder": "MANUAL", "templateSuffix": "single"}}

If I delete the image from the Shopify admin panel and send the same object, it is saved correctly.

I am not sure what might be happening because the error is not very descriptive.

Has anyone else experienced this?

Thank you!

It seems the issue is with the image URL. Ensure the URL is publicly accessible and ends with a valid image extension (like .jpg or .png).

If the problem persists, try using a different image hosting service.

The URL is an example; when the collection is newly created or an image is added to it, updating it works. However, when it already has an image, it fails.

Hi David,

Are you using the collectionUpdate mutation? The mutation should look something like:

mutation UpdateCollectionImage {
  collectionUpdate(input: {
    id: "gid://shopify/Collection/1234567890", 
    image: {
      src: "https://example.com/new-image.jpg", 
      altText: "New Image Description"
    }
  }) {
    collection {
      id
      title
      image {
        src
        altText
      }
    }
    userErrors {
      field
      message
    }
  }
}

This issue still persists. I can confirm the same behavior David originally described. collectionCreate with a given image URL works fine. collectionUpdate with the same image URL fails with the error message as follows:

  • {:src=>“Error updating collection with this image”}

If you manually delete the image in the Shopify Admin and run collectionUpdate again, it works fine.