Published on July 24, 2026
Quick Answer: Fix Zapier Xero invoice line item errors in the order the data moves. First, make the Xero Find or Create Contact step search with the same field type you mapped. Second, inspect the Line Itemizer output for currency symbols, joined values, or arrays with different lengths before sending decimals to Xero. Third, use a Code by Zapier step to replace a missing or zero quantity with 1 only when that matches the business rule and the arrays remain positionally aligned. Retest with a real multi-item order, not another one-line sample.
Table of Contents
- Why the first successful test is misleading
- Stage 1: Fix the contact search before the invoice runs
- Stage 2: Trace the decimal error back to the line-item payload
- Stage 3: Default missing quantities without hiding bad data
- Map the normalized arrays into Xero
- Test the cases that single-item samples miss
- Know when to stop patching the Zap
- Frequently asked questions
A Zap that creates one clean Xero invoice can still be structurally broken. Contact lookup, line-item formatting, and quantity validation are separate layers. The Xero action reports the failure it receives, not necessarily where the bad value originated.
At the platform level, Alltomate’s Zapier guide explains how data moves and changes between workflow steps. For this invoice use case, the fix belongs inside the validation portion of a wider document automation workflow: resolve the contact, normalize the item arrays, enforce the quantity rule, and only then create the invoice.
Why the First Successful Test Is Misleading
Single-item test data hides alignment problems. One description, one unit amount, and one quantity naturally occupy the same position. Add a second product and the Zap must preserve three parallel lists: description 2 must stay paired with amount 2 and quantity 2. If one list is empty, flattened into text, or shifted by one position, the invoice payload becomes unreliable.
A common pattern in multi-item invoice builds is a Zap passing its editor test with one product and failing in Zap History when a live order contains several. For example, an add-on without a quantity can expose both a missing array value and a malformed amount. The Xero error appears downstream, but the actual defect was introduced before the invoice action.
The comparison below shows why a one-item success cannot prove that a multi-item invoice is positionally safe.

Treat the three errors as one diagnostic chain, not one bug:
- Identity: Did the contact search use the intended lookup field and return the correct Xero contact?
- Shape: Did every line-item property produce one value per invoice row?
- Validity: Are amounts numeric and quantities present under the business rule?
Stage 1: Fix the Contact Search Before the Invoice Runs
Zapier lists Search By as required for Xero’s Find or Create Contact action. A common mistake is choosing one search mode while mapping a different type of value.
As illustrated below, a mismatched lookup rule can make the same customer appear to be a new contact and trigger an unwanted duplicate.

Open the contact step and check it literally:
- Choose the intended Search By option as a static selection.
- Map the matching source value into its lookup field.
- Normalize the selected lookup value upstream, including accidental leading or trailing spaces.
- Test an existing contact and verify that the step returns the intended Xero record.
- Test a new contact and confirm the create branch fills required fields.
- Map the exact returned contact output accepted by the current invoice action, such as the contact name or identifier shown in your Zap, rather than remapping the unverified source value.
Do not use “create” as the fallback for an ambiguous search. If two contacts share a name, define a more reliable lookup rule or route the record for review. An automatic fallback can turn a search problem into duplicate accounting records.
Use the live fields in your Zap as the source of truth because integration options can change. Zapier’s Xero integration directory lists the available Xero triggers and actions; confirm the exact required fields inside the Zap editor itself, since directory listings don’t always reflect field-level configuration.
Stage 2: Trace “Value Too Large for Decimal” Back to the Line-Item Payload
Do not start by rounding every number. A value too large for Decimal message can mean the value is genuinely outside the accepted numeric shape, but it can also mean the field no longer contains one clean number. A joined value such as 129.00149.00, a currency-formatted string, or a whole list mapped into one amount field can look like an oversized decimal to the receiving step.
The flow below separates a malformed amount string from the clean numeric values Xero expects.

Zapier’s Line Itemizer documentation explains that each property is supplied as its own set of line-item values. Descriptions, amounts, and quantities must remain aligned. If the source already returns structured line items, use those directly once they are converted into JSON array strings, as shown in Stage 3, rather than rebuilding them with Line Itemizer.
In Zap History, compare the input and output of the step immediately before Xero. For every unit amount, verify:
- one output value exists for each description;
- the value contains digits and a decimal separator, not a currency symbol or label;
- thousands separators have not been mistaken for line-item delimiters;
- two adjacent prices have not been concatenated;
- blank item rows have been removed or routed for review; and
- the output array has the same number of positions as the description and quantity arrays.
Xero treats UnitAmount as a numeric field and rounds it to two decimal places by default. Check Quantity and UnitAmount against your Xero organization’s current field constraints only after confirming Zapier is sending individual numeric values rather than malformed or concatenated text. Review the current Xero Accounting API invoice fields.
If live invoices are exposing several payload defects at once, review the whole validation path rather than adding isolated Formatter patches. See Alltomate’s invoice-processing automation approach for the wider intake, validation, exception, and accounting-sync design.
Stage 3: Default Missing Quantities Without Hiding Bad Data
A missing quantity is not always a technical error. Sometimes the source system uses an empty value to mean “one.” Sometimes it means the item configuration is incomplete. Decide which interpretation is valid before adding a default.
The decision path below makes that business rule explicit: default only approved cases and pause anything whose meaning is uncertain.

If the confirmed business rule is “a blank or zero quantity means one unit,” place a Code by Zapier action after the source or Formatter step and before Xero. Zapier’s Code step converts every mapped input into a string, including arrays — a line-item array is not preserved as an array and is not automatically valid JSON. Before mapping into this step, use a Formatter by Zapier “Utilities: Line Itemizer to Text” action (or a small preceding Code step) to build proper JSON array strings, such as [“Service A”,”Service B”,”Service C”] for descriptions and [2,null,3] for quantities, with null marking any blank position. Map the description output into an input named descriptions and the quantity output into quantities. Then use:
function requireArray(value, fieldName) {
if (Array.isArray(value)) return value;
if (typeof value === "string") {
try {
const parsed = JSON.parse(value);
if (Array.isArray(parsed)) return parsed;
} catch (error) {
// The clear error below explains the required input shape.
}
}
throw new Error(
`${fieldName} must be a structured array or JSON array string.`
);
}
const descriptions = requireArray(inputData.descriptions, "descriptions");
const sourceQuantities = requireArray(inputData.quantities, "quantities");
if (descriptions.length === 0) {
throw new Error("No line-item descriptions were received.");
}
if (descriptions.length !== sourceQuantities.length) {
throw new Error(
`Line-item count mismatch: ${descriptions.length} descriptions and ` +
`${sourceQuantities.length} quantities. Route this record for review.`
);
}
const quantities = sourceQuantities.map((value, index) => {
const normalized =
typeof value === "string" ? value.trim() : value;
if (normalized === "" || normalized === null || normalized === undefined) {
return 1;
}
const parsed = Number(normalized);
if (!Number.isFinite(parsed)) {
throw new Error(`Quantity ${index + 1} is not numeric.`);
}
if (parsed === 0) return 1;
if (parsed < 0) {
throw new Error(`Quantity ${index + 1} is negative.`);
}
return parsed;
});
return {
quantities,
itemCount: descriptions.length
};
Code by Zapier receives mapped values through inputData. Confirm the exact output in the test panel and in a live Zap run before mapping quantities into Xero.
The code replaces only blank or zero values with 1. It stops the run when the description and quantity counts differ, when an input is not a structured array, or when a quantity is non-numeric or negative. This prevents a missing middle value from shifting every later quantity onto the wrong invoice row. Zapier’s JavaScript Code step examples confirm that mapped inputs use inputData.
Use a review path instead when zero is meaningful. If zero can represent a cancelled item, a sample, a credit, or an incomplete order, automatically changing it to one can alter the invoice. Filter or flag those records instead of normalizing them silently.
Map the Normalized Arrays Into Xero as One Invoice Structure
Send Xero parallel outputs from the last trusted transformation. Do not mix normalized quantities with raw descriptions and reformatted amounts from different steps unless their order is confirmed.
The structure below shows the intended handoff: contact, description, amount, and quantity travel from one trusted transformation into one invoice payload.

| Xero field | Map from | Pre-flight check |
|---|---|---|
| Contact | Contact output accepted by the current invoice action | Returned record is the intended Xero contact |
| Description | Normalized description array | No blank row and count matches amounts |
| Unit Amount | Validated numeric amount array | No symbols, joined prices, or list text |
| Quantity | Code step quantity output | Default was applied only under the approved rule |
This last mapping review catches problems that step-by-step green checks miss. Each step can produce output successfully while the complete invoice is still semantically wrong. The counts and order of the line-item properties are the final contract.
Test the Cases That Single-Item Samples Miss
Use an acceptance matrix that forces each failure condition to appear before publishing the Zap.
| Test record | Expected behavior | What it validates |
|---|---|---|
| Existing contact, one item | Reuse contact and create one line | Baseline contact search and mapping |
| New contact, three items | Create contact and preserve three aligned rows | Create branch and array alignment |
| One blank quantity | Default that position to one | Code output length and position |
| Currency-formatted amount | Normalize or stop before Xero | Decimal validation |
| Duplicate or ambiguous contact name | Use the approved identifier or route for review | Duplicate prevention |
Check the final Xero draft, not just the Zap run. Confirm the customer, rows, quantities, amounts, tax treatment, and total. Alltomate’s Jobber–Zapier integration case study demonstrates the same reliability principle through consistent customer searches, duplicate prevention, and line-item translation.
Know When to Stop Patching the Zap
One Code step for a clear quantity rule is reasonable. A chain of Formatter patches for separators, optional fields, tax data, and changing schemas signals that the workflow lacks a stable data contract.
Define one canonical line-item object before Xero: description, numeric unit amount, approved quantity, required account or item mapping, and an exception rule. This is the implementation layer beneath the broader process described in how to automate invoice processing.
For low volume, manual review may be safer than more code. For recurring multi-item orders, normalize once, log rejected payloads, and retain representative test records. Scale increases the cost of silent defaults if the source meaning changes.
If the first visible error keeps moving between steps, use Alltomate’s broader Zapier troubleshooting guide for failed workflows to compare Data In with Data Out and locate the earliest incorrect transformation.
Recommended Fix Sequence: Resolve Zapier Xero invoice line item errors from upstream to downstream. Match the Xero contact search mode to its lookup value, inspect Line Itemizer output for malformed or misaligned arrays, and default blank or zero quantities only under an explicit business rule. Stop and review any record whose line-item counts do not match. Then test new and existing contacts with genuine multi-item records and verify the resulting Xero draft. The invoice action should be the destination of clean data, not the place where cleanup is attempted.
Still getting failed or inaccurate Xero invoices?
Alltomate can diagnose the contact mapping, line-item structure, and exception logic behind your Zapier–Xero workflow.
Related Resources
Frequently Asked Questions
Why does Zapier create a duplicate Xero contact before making the invoice?
The search mode may not match the mapped value, or that value may not uniquely identify the contact. Verify the Search By selection and confirm the returned record before allowing the create fallback.
What causes “value too large for Decimal” in a Zapier Xero invoice?
The value may exceed Xero’s numeric constraints, but malformed input is often the real cause. Check for joined prices, currency-formatted strings, or a complete list mapped into one Unit Amount field.
Should I use Line Itemizer if the source app already returns line items?
Usually not unless Xero requires a different structure. Convert the source’s structured output into JSON array strings and map those directly, since rebuilding line items with Line Itemizer adds another place for item order or counts to break.
Should every missing Xero line-item quantity default to one?
Only if the business has confirmed that blank or zero means one unit. Otherwise, route the record for review so a technical default does not change its accounting meaning.
Why does a one-item Xero invoice work while a multi-item invoice fails?
One item cannot reveal mismatched array lengths or shifted positions. Test a record with several items and one controlled exception to confirm every property stays aligned.
About the author

Miguel Carlos Arao is the Founder & CEO of Alltomate, a Zapier Platinum Solution Partner focused on automation architecture, workflow validation, and reliable business systems.
This article applies those disciplines to contact resolution, line-item normalization, and quantity validation in Zapier–Xero invoice workflows.

Explore more at
Document Automation Services and
Zapier Platform Overview.