# PUT /collections/{{collection\_uid}} returns "This collection already exists in the database."

**URL:** <https://community.postman.com/t/put-collections-collection-uid-returns-this-collection-already-exists-in-the-database/7751>\
**Category:** Help Hub\
**Tags:** documentation, collections, openapi-to-postmanv2\
**Created:** [September 12, 2019, 7:14pm UTC](https://community.postman.com/t/put-collections-collection-uid-returns-this-collection-already-exists-in-the-database/7751 "2019-09-12T19:14:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skipiodev](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@skipiodev](https://community.postman.com/u/skipiodev)\
**Post date:** [September 12, 2019, 7:14pm UTC](https://community.postman.com/t/put-collections-collection-uid-returns-this-collection-already-exists-in-the-database/7751/1 "2019-09-12T19:14:00Z")

</div>

_This looks like a bug in the Postman API, I’ve submitted an issue in Github [here](https://github.com/postmanlabs/postman-app-support/issues/7315) 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):

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

```

**@ShiftDevUser** had the same problem with this `PUT` endpoint _([community question here](https://community.postman.com/t/publishing-documentation-to-custom-urls-for-each-environment/7088/4))_. 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.

---

<div class="post-metadata">

**Author:** ![skipiodev](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@skipiodev](https://community.postman.com/u/skipiodev)\
**Post date:** [September 20, 2019, 2:55pm UTC](https://community.postman.com/t/put-collections-collection-uid-returns-this-collection-already-exists-in-the-database/7751/2 "2019-09-20T14:55:58Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![kinlane](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kinlane/32/347_2.png) [@kinlane](https://community.postman.com/u/kinlane)\
**Post date:** [December 8, 2021, 6:44pm UTC](https://community.postman.com/t/put-collections-collection-uid-returns-this-collection-already-exists-in-the-database/7751/3 "2021-12-08T18:44:46Z")

</div>

I encounter this from time to time and forget the solution, and end up Googling and finding myself here. So I will post the solution for my future self, and you. 😉

If any of your requests already have IDs on them it will cause it to fail. Remove all. your request Ids.
