productCreate doesn't fail if handle already exists

This has been an issue for awhile, but raising this again

If I do a productCreate and the handle (my-handle) already exists Shopify does not failbut appends an hypehn and number to the end (my-handle-1, my-handle-2
)

Shopify should fail, and send a fail message (this happens with other create options

I know I can lookup a handle but that isn’t efficient

Any solutions?

If that’s correct, it sounds like a bug. Do you use the 2025-01 GraphQL Admin API?

So look like a recent change. I have been using 2024-10 and that creates and creates. Just tried in Postman with 2025-01 and I get the below, which is the sort of thing I have been expecting for years. So action for me is to move version 2025-01 I think

Thanks

{
    "data": {
        "productSet": {
            "product": null,
            "productSetOperation": null,
            "userErrors": [
                {
                    "code": "HANDLE_NOT_UNIQUE",
                    "field": [
                        "input",
                        "handle"
                    ],
                    "message": "Handle 'the-guilt-pill-saumya-dave' already in use. Please provide a new handle."
                }
            ]
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 164,
            "actualQueryCost": 50,
            "throttleStatus": {
                "maximumAvailable": 20000.0,
                "currentlyAvailable": 19950,
                "restoreRate": 1000.0
            }
        }
    }
}

Edit. It is mentioned here ProductSetUserErrorCode - GraphQL Admin

But not in any release notes from what I can see. Very annoying.

1 Like

Nice to hear. Definitely a recent change in the new API. Before it was expected behaviour to append -{n}.