> For the complete documentation index, see [llms.txt](https://docs.mosip.io/1.2.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mosip.io/1.2.0/setup/upgrade/upgrade-runbook/mock-services/upgrade-non-recoverable-packets.md).

# Handling Non-Recoverable Packets

After running the reprocess utility and regproc reprocessor, it is possible that a few packets may end up in the FAILED status. This can occur due to various reasons such as environment instability or high parallel processing of packets. The following steps will help in identifying if such packets exist and how to handle them.

To handle these packets, please follow the below steps:

1. Use the sample query below to find out if there are packets in a non-recoverable state:

```
SELECT * FROM registration WHERE status_code='FAILED' AND latest_trn_Dtimes > '2023-10-10 10:00:00.000000' AND cr_Dtimes < '2023-08-25 00:00:00.000000';
```

Here, `cr_Dtimes` should be less than the time of upgrade completion and the processing of the first packet. `latest_trn_Dtimes` should be greater than the time of upgrade completion and the processing of the first packet. If there are no packets in this status, no further action is required. If any packets are found with the above status, proceed to step 2.

2. Before running the reprocess utility to process the packet from the beginning [as per the APPROACH 1 in document](/1.2.0/setup/upgrade/upgrade-runbook/mock-services/upgrade-regproc-reprocessing.md), update the DEFAULT QUERY in the [config.py](https://github.com/mosip/mosip-infra/blob/1.2.0.1/deployment/sandbox-v2/utils/reprocess/config.py) file as per the requirements to process non-recoverable records.

The sample query is as follows:

```
SELECT reg_id, process, workflow_instance_id, iteration FROM registration WHERE status_code='FAILED' AND latest_trn_Dtimes > '2023-10-10 10:00:00.000000' AND cr_Dtimes < '2023-08-25 00:00:00.000000' LIMIT 1000;
```

Here, the status code should be set to FAILED. `cr_Dtimes` should be less than the time of upgrade completion and the processing of the first packet. `latest_trn_Dtimes` should be greater than the time of upgrade completion and the processing of the first packet.

After changing the query in [config.py](https://github.com/mosip/mosip-infra/blob/release-1.2.0.1/deployment/sandbox-v2/utils/reprocess/config.py), please refer to the documentation on [how to set up and run the reprocessor script](https://github.com/mosip/mosip-infra/tree/release-1.2.0.1/deployment/sandbox-v2/utils/reprocess).

To reprocess packets, use the following command:

```
$ ./reprocess.py --db
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mosip.io/1.2.0/setup/upgrade/upgrade-runbook/mock-services/upgrade-non-recoverable-packets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
