# Collections exists function returns FALSE yet collection already exists

**URL:** <https://forum.weaviate.io/t/collections-exists-function-returns-false-yet-collection-already-exists/2082>\
**Category:** Support\
**Tags:** bug, wcs\
**Created:** [April 22, 2024, 12:41pm UTC](https://forum.weaviate.io/t/collections-exists-function-returns-false-yet-collection-already-exists/2082 "2024-04-22T12:41:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Oschler](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/robert_oschler/32/1308_2.png) [@Robert\_Oschler](https://forum.weaviate.io/u/Robert_Oschler)\
**Post date:** [April 22, 2024, 12:41pm UTC](https://forum.weaviate.io/t/collections-exists-function-returns-false-yet-collection-already-exists/2082/1 "2024-04-22T12:41:12Z")

</div>

I am using the Weaviate Cloud Services. I created a schema named `test_schema_1`. That worked fine. I then added this code to my utility script to avoid recreating the schema if it exists:

```js
    const useCollectionName = 'test_schema_1';

    const bIsExistingCollection =
      await client.collections.exists(useCollectionName);

    if (bIsExistingCollection) {
      console.warn(CONSOLE_CATEGORY, `The following schema already exists. Not creating schema: ${useCollectionName}`);
    } else {
      console.info(CONSOLE_CATEGORY, `Creating schema named: ${useCollectionName}`);

      await addSchema(neoBlockchainSchema);
    }

```

Unfortunately, “client.collections.exists(useCollectionName)” is returning **false**. Therefore, when the `addSchema` call is made, I get a “duplicate schema” error:

```auto
usage error (422): {"error":[{"message":"class name \"test_schema_1\" already exists"}]}

```

I am using the JS/TS beta version of the client. Is this a bug? Should I open a GitHub issue on this?

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 22, 2024, 1:42pm UTC](https://forum.weaviate.io/t/collections-exists-function-returns-false-yet-collection-already-exists/2082/2 "2024-04-22T13:42:10Z")

</div>

Hi Robert! I will take a look on that.

Can you check if the collection exists using REST or listing?

> **[Weaviate - Vector Database](https://weaviate.io/developers/weaviate/api/rest#tag/schema/get/schema)**

Also, it may check exactly for the same name, and it usually gets capitalized. So that can influentiate too.

---

<div class="post-metadata">

**Author:** ![Robert\_Oschler](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/robert_oschler/32/1308_2.png) [@Robert\_Oschler](https://forum.weaviate.io/u/Robert_Oschler)\
**Post date:** [April 22, 2024, 2:14pm UTC](https://forum.weaviate.io/t/collections-exists-function-returns-false-yet-collection-already-exists/2082/3 "2024-04-22T14:14:29Z")

</div>

How do I craft a REST API query to check my WCS cluster, including my API key? The sample you gave me shows a localhost instance.

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 22, 2024, 7:32pm UTC](https://forum.weaviate.io/t/collections-exists-function-returns-false-yet-collection-already-exists/2082/4 "2024-04-22T19:32:52Z")

</div>

There you go:

```auto
curl https://your-wcs-endpoint.weaviate.cloud/v1/schema -H "Authorization: Bearer YOUR-WEAVIATE-API-KEY"

```
