---
title: "Handle a file that no longer fits"
description: "Learn how to see what changed in a customer's export and freeze a new version of its card."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.certinvo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle a file that no longer fits

When a customer updates their accounting software, a column may be renamed, reformatted or dropped. A
file that used to work is then refused. This guide shows you how to see what changed and freeze a new
version of the mapping card, reviewing only what moved.

That change is called **drift**. 

## Which changes are caught

- **In every format but a PDF**, a field the card has never seen is named: a new column, a new key, a new
  element, a partner the card does not read by its qualifier. The file converts, and the answer notes it.
- **In a CSV or Excel file**, every column the card reads is checked. A renamed or missing column is noted the
  same way. A column the invoice cannot be made without, such as its issue date, is refused when it is gone.
- **In a JSON, XML, IDoc or EDIFACT file**, a missing key alone is not refused, because such files often leave
  out an empty value. A renamed key is still caught: its new name is a field the card has never seen.
- **In a text PDF**, a renamed label is refused only when it fills a required field. Otherwise the invoice goes
  out without that value, and nothing starts this guide.
- **In every format**, a value whose shape changed is refused, such as text where the card reads an
  object.

## A file with a new or a missing field

A file with a field the card has never seen, or without a column it reads, converts. The answer carries a note
for each kind, `new_fields` or `missing_fields`, naming the card and each field; the list on **Outbound** says
it. This is a Certinvo check, not a legal requirement: the validator decides each invoice. To read the new field, or
to take a renamed one, save the card's next version from the file:

1. Open the card on the Convert page with the file, as its next version.
2. Only what changed is open. Each new field shows what the profiler proposes: **Confirm** it, **Choose another**
   column, or leave the field unmapped. Everything the card already decided is copied over.
3. Save. From then on, every file like it converts with no note.

A renamed field is answered the same way. In the editor the old field proposes the new column; **Confirm** it once,
and the mapping keeps both names. Files under the old name and the new name then both convert. A file that has both
names at once is refused: two answers for one field.

## What you see

A file sent through a card can also be refused with one of two codes. Sent without naming a card, it is read by the
card that knows most of its layout, and the refusal names that card in `error.mappingVersion`. A file that no card
knows well enough comes from another system, and is refused with `no_mapping_fits`.

- `unreadable_file`: the file no longer matches the card's `input` block. For example, a grouping column
  is missing.
- `unmappable_payload`: the file can be read, but some records cannot be mapped.

A file whose layout is the same but whose dates or amounts are now written another way is held with
`value_format_changed`. Its row waits for one answer, and names each column, how it was written and how it is
written now. [Confirm values written another way](/how-to/customer-files/confirm-values-written-another-way)
shows that case.

## Fix it in the console

1. Submit the file as a mapped-file conversion: upload it on **Outbound**, drop it on **Convert**, or use
   **Send file through mapping** on `/batches`.
2. When the file is refused with one of those two codes, the console runs a drift check against the card it
   was read through, automatically.
3. If the layout really changed, the console opens the **Convert page** for a new file, `/convert?new=1`,
   which reads the new file into a draft and opens it in its editor, `/mappings/<id>`. A PDF
   without an e-invoice is first asked about, as any PDF opened in Convert is: it is read with AI only after a
   yes for that file, whatever Settings say. A notice over the form says "Your mapping … changed" and
   asks whether to update it; it lists what changed. A line says how much of the card is touched: "N of M fields
   of the active version are affected. The other fields are copied from it unchanged." In the file beside the
   form, the value of a moved column says where it was before, and the value of a new column says **New column**.
   On **Outbound**, a file that shares no field with that card is a new layout instead: the Convert page opens to
   teach it, with no card behind it. When the check finds no layout change, the row says what that card cannot
   fill.
4. The draft starts from the active version. Every field whose column is still there and reads the same is
   copied over exactly, and shows as **Mapped**. A renamed, reformatted or lost field is never copied: it stays
   open for you, as **To decide** or **Missing**. A column the active version left out is left out again, while
   the new file still has it.
5. Fix the open fields, as in setup. You do not repeat the whole setup.
6. To test on more files of the new layout, choose **Add file** at the top right. They join the draft, and
   **Test** runs on all of them.
7. Choose **Save and convert**. The draft is saved as the card's next version, under the card's own name, and the save dialog
   says which version that is; so it replaces the old version when the API picks a card for a file. The old
   version stays unchanged. When the file comes from another system after all, choose **This comes from a
   different system** in the notice: the file is drafted again with no card behind it, and saved under a name of
   its own, typed in the save dialog.
8. The console then sends the waiting file through the new version. The page that says the version is saved also
   says whether the file was accepted, and **Open in Outbound** shows its invoices. For a PDF the save dialog
   offers to keep its page as the page of every PDF made.

The waiting file is kept only in this browser tab. If you leave for another page and open **Convert** again,
its draft opens with every choice you made; the file is not read afresh. Opening another draft from Mappings lets
the waiting file go. If you reload the page before saving,
the draft opens again in its editor, `/mappings/<id>`, and the Mappings page lists it too. The waiting file is gone.
Send it again after saving.

### Fix a refused invoice's field

A refused invoice's finding offers **Fix in mapping**, with the version of the mapping that made it. It opens the
Convert page the same way, with three differences:

- the sample is the refused invoice's own file;
- the form opens on the field the finding names, its card open and in view;
- saving the new version sends nothing. Afterwards the page offers **Send the file through** the new version.
  The refused invoice stays as it is; sending makes a new invoice from the file.

If the file cannot be fetched, the Convert page opens without it.

## Fix it through the API

Ask for the same draft with `POST /v1/mappings/drafts`. Send the new files as `samples` and the active
version as `from`. The answer lists the fields carried over in `carried`, with any list inside a line
carried whole, such as a line's allowances. A column the active version left out comes back left out, as a
`{column, ignore: true}` decision. Each copied decision is marked `carried: true`. A `from` this company never froze is refused with 404 `unknown_mapping_config`,
and nothing is drafted.

A caller with an API key gets the plain refusal from the send. To run the drift check yourself, ask
`POST /v1/mappings/{version}/drift`, the route the console asks.

## What the check reports

For each field of the frozen card that reads a column, the drift answer gives one of these results. A
field with a fixed value (`const`) reads no column, so it can neither move nor be lost, and is left out.

| Result | Meaning |
|---|---|
| `unchanged` | Still read from the same column, in the same format. |
| `renamed` | The same content now sits under a new header. |
| `reformatted` | The same column, but its values now need a different converter, for example a new date format. |
| `lost` | The field's column is gone. The answer lists candidate columns, ranked by content. It never assumes a leftover column is the renamed one. |

The answer also lists new columns, lost line structure, and whether the engine could still read the
file with the card's `input` block at all. A column the card already knew when it was saved, one it reads, left
out or left open, is never a new column: a file that only fails on a value is not a changed layout.

The console's impact line counts these results: the renamed, reformatted and lost fields, out of all
four kinds together. A card that reads no column gets no impact line.

## When the check finds nothing to fix

- **No change of layout.** The plain refusal stays, and the problem is in the data itself.
- **A code the card does not know.** An invoice carries a code that is not in the card's code table, not
  on the field's official list, and not a word the dictionary reads (`unmapped-code`). On `/batches`, the
  console takes such a file to the Convert page, marked as stopped on a code. The screen says so, drafts
  a new version from the card it was sent through with this file as the sample, and lists the new code
  under its field as needing a meaning. Choose its official code, freeze the new version, and the waiting
  file is sent through it.
- **No card at all.** Drop the file on the Convert page, `/convert`, and choose **Create a mapping from this
  file** when it says no saved mapping reads it, or choose **New from file** on the Mappings page, when no card was
  ever frozen for that export. Upload the sample, review the proposed fields, and freeze the first version. Then submit the
  waiting file as a mapped-file conversion naming that version. The conversion API never guesses a
  mapping from the file.
- **A file that two of your cards read.** Two cards that decide the same are one card: the newest reads the
  file, the other is retired, and nothing is asked. Two that would make different invoices are asked about: the
  file stays on **Outbound**, its page lists both versions, and **Convert with this one** sends the file through
  the one you pick, there. The pick is remembered for files of that layout. Nothing is drafted or frozen, because
  nothing changed.

## Limits

- Drift works for cards with an `input` block in CSV, JSON, Excel, a company's own XML, SAP IDoc,
  EDIFACT and a text PDF.
- Only a CSV file or an Excel sheet can lose its **line structure**, because only they group rows by a
  declared column. JSON, XML, IDoc and EDIFACT records arrive nested, so the answer never reports a lost
  grouping for them.
- Drift never changes a card by itself. A person always freezes the new version.

## See also

- [Convert a file through a mapping](/how-to/customer-files/send-a-file-through-a-mapping): send a file
  and read its refusals.

Source: https://docs.certinvo.com/how-to/customer-files/handle-a-file-that-no-longer-fits/index.mdx
