# How to catch errors with dynamic batch import

**URL:** <https://forum.weaviate.io/t/how-to-catch-errors-with-dynamic-batch-import/3081>\
**Category:** Support\
**Tags:** python\
**Created:** [July 18, 2024, 5:06am UTC](https://forum.weaviate.io/t/how-to-catch-errors-with-dynamic-batch-import/3081 "2024-07-18T05:06:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![md1639](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@md1639](https://forum.weaviate.io/u/md1639)\
**Post date:** [July 18, 2024, 5:06am UTC](https://forum.weaviate.io/t/how-to-catch-errors-with-dynamic-batch-import/3081/1 "2024-07-18T05:06:53Z")

</div>

### Description

I’m trying to batch import data into a collection like so:

```auto
with filings_collection.batch.dynamic() as batch:
    for fc in tqdm(filngs_chunked):
        batch.add_object(
            properties=fc,
        )

```

I’m having trouble catching errors. I find that there is a number\_errors attribute, however this doesn’t tell me which object exactly has failed, or what the error is

### Server Setup Information

- Weaviate Server Version: 1.25.5
- Deployment Method: embed
- Multi Node? Number of Running Nodes: No, 1 node
- Client Language and Version: Python 3.12.4, weaviate version 4.6.5
- Multitenancy?: No

### Any additional Information

---

<div class="post-metadata">

**Author:** ![Shahin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shahin/32/7944_2.png) [@Shahin](https://forum.weaviate.io/u/Shahin)\
**Post date:** [July 18, 2024, 7:48am UTC](https://forum.weaviate.io/t/how-to-catch-errors-with-dynamic-batch-import/3081/2 "2024-07-18T07:48:19Z")

</div>

Hello @md1639,

Welcome to our community! it’s great to have you here 🤗

You can consider capture more information about errors and failed objects by implementing error handling and logging during the batch process by using **client.batch.failed\_objects & client.batch.failed\_references.**

### Error Handling →

> **[Python | Weaviate Documentation](https://docs.weaviate.io/weaviate/client-libraries/python)**
>
> Official Python client library documentation for integrating Weaviate with Python applications and services.

You will find a good example in the documentation:

> failed\_objs\_b = client.batch.failed\_objects # Get failed objects  
> failed\_refs\_b = client.batch.failed\_references # Get failed references

Additionally, Weaviate Pythin Client, the following exception handling can help raises various error conditions:

- `weaviate.exceptions.WeaviateConnectionError` for failed connections.
- `weaviate.exceptions.WeaviateQueryError` for failed queries.
- `weaviate.exceptions.WeaviateBatchError` for failed batch operations.
- `weaviate.exceptions.WeaviateClosedClientError` for operations on a closed client.

You can review [this module](https://github.com/weaviate/weaviate-python-client/blob/main/weaviate/exceptions.py) which defines the exceptions that can be raised by the client library.

### Exception handling →

> **[Python | Weaviate Documentation](https://docs.weaviate.io/weaviate/client-libraries/python)**
>
> Official Python client library documentation for integrating Weaviate with Python applications and services.
