PUT /collections/{{collection_uid}} returns "This collection already exists in the database."

This looks like a bug in the Postman API, I’ve submitted an issue in Github here with the same info.

Our team uses Swagger and Postman. We use swagger-parser and openapi-to-postmanv2 to create a bundled/dereferenced swagger file that we then convert to Postman format used for updating our Postman collection.

Hitting PUT /collections/{{collection_uid}} with the openapi-to-postmanv2 file works (as expected), but occasionally we’ll get a 400 error that shouldn’t be one of the PUT responses (according to your docs):

    "error": {
        "name": "instanceFoundError",
        "message": "This collection already exists in the database."

@ShiftDevUser had the same problem with this PUT endpoint (community question here). We tried replacing "id", "_postman_id", and other found data but it didn’t fix this.

Our converted Postman file is too large (33,000+ lines) to try to understand where/what is causing this unknown error. We would love help as to what/where we should look for that would cause this error?

Expected Behavior
We’re not creating new data, or patching data ontop of what’s currently there. This error would make sense from a POST endpoint (and maybe from a PATCH endpoint?), but not from a PUT endpoint. I believe PUT should overwrite the whole JSON object. To my knowledge, this endpoint isn’t creating anything new that would cause a conflict like this.

Additional context
So far re-running the openapi-to-postmanv2 converter (which creates new SchemaFaker data even though no changes to the docs were made) will fix the issue, allowing us to PUT again. This is ok, but doesn’t let us know where or what the issue is. We would like to fix this, instead of re-running the converter over-and-over until the output works.

I’ve confirmed this happens when I hit this endpoint via our Rails app, and from the Postman UI.

I just tried the same failing JSON file and the Postman API endpoint no longer errors out. I’m guessing the problem has been fixed. :slight_smile: