Collection Recreation Fails with 422: Class Already Exists – Need Help

Description

I’m encountering a persistent UnexpectedStatusCodeError when trying to create a collection in Weaviate:

“name”: “UnexpectedStatusCodeError”,
“message”: “Collection may not have been created properly.! Unexpected status code: 422, with response body: {‘error’: [{‘message’: ‘class name Collection_test_test already exists’}]}”

This occurs even after attempting to delete the existing collection before recreating it.

Server Setup Information

  • Weaviate Server Version: 1.30.7.
  • Deployment Method: Docker Image
  • Multi Node? - Running locally on my machine and Weaviate Cloud instance
  • Client Language and Version: Python (v4 client)
  • Multitenancy?: No

Any additional Information

What I’ve Already Tried:

  1. Tested with new collection names (same error occurs).
  2. Upgraded Weaviate server from 1.29 to 1.30.7.
  3. Uninstalled and reinstalled the latest weaviate-client package.

Note:

Ensured logic deletes and recreates the collection:

if _client.collections.exists(collection_name):
_client.collections.delete(collection_name)
time.sleep(2)
_client.collections.create(collection_name, …)
else:
_client.collections.create(collection_name, …)

The exact same logic **worked fine until last Friday. Even if the collection name is entirely new and never used before, the error is still raised.

hi @Rupa !!

Welcome to our community :hugs:

Do you see any error logs on server after you issue the delete collection command?

Thanks!