Oasis
March 1, 2025, 2:08pm
1
Hi,
I can not find any information of the exact return format of collection.batch.failed_objects. I need to make sure that my application handles this error correctly and retries failed objects, but without knowing the exact format of the returned objects I can not do that. Can anyone help me out?
Thank you in advance!
hi @Oasis !!
Welcome to our community
You can provoke that error, like so:
collection = client.collections.delete("Test")
client.collections.create("Test")
with client.batch.dynamic() as batch:
batch.add_object(
collection="Test",
properties={"text": "object1"},
vector=[1,2]
)
batch.add_object(
collection="Test",
properties={"text": "object2"},
vector=[1,2,3]
)
if client.batch.failed_objects:
print(f"Found {len(client.batch.failed_objects)} failed objects" )
print(client.batch.failed_objects)
this will be the output:
Found 1 failed objects
[ErrorObject(message=‘inconsistent vector lengths: 3 != 2’, object_=BatchObject(collection=‘Test’, properties={‘text’: ‘object1’}, references=None, uuid=‘378e10c3-e63a-44ab-bcaf-e41792e69b3c’, vector=[1, 2], tenant=None, index=0, retry_count=0), original_uuid=‘378e10c3-e63a-44ab-bcaf-e41792e69b3c’)]
By the way, check out this awesome recipe on batch ingestion retry:
Let me know if that helps!
THanks!
Dirk
March 3, 2025, 8:29am
3
Hey, all of our output is typed and will be stable.
You can import the definitions of the returned type here:
from weaviate.outputs.batch import ErrorObject
collection.batch.failed_objects
returns List[ErrorObject]
1 Like