An error occurred: The 'objects' creation was cancelled because it took longer than the configured timeout of 60s. Try reducing the batch size (currently 1) to a lower value. Aim to on average complete batch request within less than 10s

Description

Server Setup Information

  • Weaviate Server Version: 1.21.2
  • Deployment Method: docker
  • Multi Node? Number of Running Nodes:
  • Client Language and Version:
  • Multitenancy?:

Any additional Information

Running into " An error occurred: The ‘objects’ creation was cancelled because it took longer than the configured timeout of 60s. Try reducing the batch size (currently 1) to a lower value. Aim to on average complete batch request within less than 10s " when trying to import data with batch size one using following snippet


    @staticmethod
    def import_data_to_weaviate(client, vectorDB, properties, emb1, emb2, embedding_to_insert):
        """
        Imports data into Weaviate by adding objects with embeddings.
        """
        client.batch.configure(batch_size=1)  # Configure batch
        with client.batch as batch:
            try:
                # Generate a unique identifier based on the embeddings
                uuid = weaviate.util.generate_uuid5(emb1.tobytes() + emb2.tobytes())
                batch.add_data_object(properties, vectorDB, uuid=uuid, vector=np.array(embedding_to_insert))
                
            except Exception as e:
                print(f"An error occurred: {e}")

The error seems to occur randomly at times.

hi @Syed_Hamza !!

Welcome to our community :hugs:

Version 1.21 is really old, I would strongly suggest you to migrate it.

Considering the version, you are probably using the python v3 version.

How are you vectorizing that object?

We strongly suggest you to move to a newer version and leverage the new python v4 client with GRPC. Not only it is more performant, but also easier to debug.

It would be interesting to check this documentation on how to do error handling with python v3 client:

Let me know if that helps!