> For the complete documentation index, see [llms.txt](https://docs.cleartax.in/product-help-and-support/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cleartax.in/product-help-and-support/for-large-businesses/e-invoicing/resolving-error-in-terminal-state.md).

# Resolving Error in Terminal State

In this tutorial, you'll learn how to handle an error message that occurs when trying to ingest a document that's already in a terminal state.

{% embed url="<https://youtu.be/uFFnd-9Itq0?si=Mr_19STaiEeL2f3Z>" %}
Understand terminal errors and how to resolve them effectively
{% endembed %}

{% stepper %}
{% step %}
Start by ingesting your document. If you try to ingest the same document again, you'll encounter an error.

![](/files/7RPWdrLwGgpV0TEoqQnr)
{% endstep %}

{% step %}
Import the same document again.

![](/files/661pXfa3mxhQbUgQGkQF)
{% endstep %}

{% step %}
Note that the Excel sheet you're importing contains the same data.

![](/files/OQhettLt0pp1qqCC3Elz)

![](/files/SIxQlRtf5j0J7ONMEUXB)
{% endstep %}

{% step %}
Select the same template and attempt to reinvest the data.

![](/files/rerqUD2HLYWlMty4F16Y)
{% endstep %}

{% step %}
Review the error message that appears.

![](/files/JEBlxv0bekVVR6MkVkUg)

![](/files/X0yzxCS6O3JY1oNty2Id)

The error message indicates that invoices in a terminal state can't be modified. This happens when you try to reinvest data for an invoice that's already been generated. The government doesn't allow the same invoice number to be used again, so you'll need to use a different document number.
{% endstep %}

{% step %}
If you're facing this issue, check the document number.

![](/files/0iNm0v3Rvs2rjmb0Mwf2)

Copy the document number, close it out, and go to the filters.

![](/files/QI9XHVXcvjYEYK0zheV1)

![](/files/wcVcR4zKeWvOTXMo24YL)
{% endstep %}

{% step %}
Apply the document number in the filters.

![](/files/Pb2LO2LFzxkfpFgmqYN2)
{% endstep %}
{% endstepper %}

This way, you can check if the document was already generated and update your team accordingly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cleartax.in/product-help-and-support/for-large-businesses/e-invoicing/resolving-error-in-terminal-state.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
