# Match Mistral Batch Results to the Right Input Rows

> Reconcile Mistral chat batch JSONL by custom_id, preserve input order, and surface failed or missing rows before merging results.

Canonical article: https://modelrovia.com/guides/mistral-batch-match-results/
Author: Modelrovia Editorial
Published: 2026-11-11
Updated: 2026-11-11

## Key takeaway

Reconcile saved chat batch records by ID and distinguish success, failed response and missing row.

When importing a Mistral chat batch, join output records to your input by `custom_id`. Keep the original IDs even if the final deliverable is a spreadsheet. An output file may have fewer usable rows than the input, and matching line one to line one can attach the wrong response to a record. The official batch guide shows the input identifier and the quickstart uses it when reading results. [Mistral batch quickstart](https://docs.mistral.ai/inference/quickstarts/run-a-batch-job)

## Run a sample with an incomplete result

Save the [reconciliation script](/examples/mistral-batch-reconcile.py), [requests](/examples/batch-reconcile-requests.jsonl) and [results](/examples/batch-reconcile-results.jsonl) in the same folder.

~~~sh
python mistral-batch-reconcile.py batch-reconcile-requests.jsonl batch-reconcile-results.jsonl
~~~

On November 11, 2026, the local run printed:

~~~text
cedar: failed (HTTP 429)
birch: "Birch"
spruce: missing
~~~

The sample contains a synthetic success followed by a synthetic failure. The script prints in input order. Exit status 1 is expected here because two inputs lack a usable answer. This is an offline reconciliation test with a deliberately incomplete file.

## Decide what belongs in the export

Keep three separate counts. Count the original requests, count usable responses, and count rows needing review. For this fixture those are three, one and two. Check that the last two counts add up to the first before handing the spreadsheet to a downstream system.

The script treats an unknown or repeated ID as an input problem and stops rather than choosing an arbitrary record. For each matched ID it requires a successful HTTP code and nonempty chat text. A response can still be unsuitable if it contains the wrong information. Use a separate check for your task, such as an expected category from an approved support ticket. [Promptfoo output replay](/guides/promptfoo-replay-saved-outputs/)

## Triage before retrying

For an actual completed job, inspect its status and both the output and error files according to the current batch documentation. This script reads one result file using the chat-completion response shape. Preserve any separate error file for diagnosis. A missing ID in this file means the script found no matching record here. Check the other artifacts before assuming the service never processed that input.

Keep the original request manifest and the job ID. Once you understand a failure, prepare a retry subset containing only the affected IDs. When merging a second run, choose explicitly which attempt replaces a previous failure and keep that choice in your records. The sample avoids an automatic retry because the same symptom can come from a missing file, an invalid request or a transient service response.

## Sources & references

- [Mistral batch processing guide](https://docs.mistral.ai/inference/batch-processing)
- [Mistral batch quickstart](https://docs.mistral.ai/inference/quickstarts/run-a-batch-job)

[Editorial standards](https://modelrovia.com/methodology/)
