CalculatorFree mockup
Proofsite Blog · guide

Merchant Center rejected your XML feed: what causes the formatting error and how to fix it

When Google cannot process your product feed, products drop out of Shopping and the ads built on them go quiet. The cause is usually one character or one empty field. Here are the six most common culprits and the order to fix them in.

Developer working at a desk with a laptop and a monitor showing code

Free tool: check your XML feed in the browser. It shows the line of the error, duplicate ids, missing fields and bad price formats. The file is not uploaded anywhere.

Two kinds of problems: the file fails, or only some products fail

Before you hunt for a cause, work out which situation you are in. The first is an XML syntax error: the file is broken as a whole, Merchant Center cannot process it, and the product count in your account drops or stops refreshing. The second is a data error: the file is valid XML, but some products lack required fields or carry a price in the wrong format, so Google rejects them one by one and lists the reason in diagnostics.

The first four sections below are about syntax, the last two about data. You can run all of it through our checker, but it helps to know where each error comes from, because the fix belongs where the feed is written.

1. An ampersand that is not escaped

This is the most frequent cause. In XML an ampersand starts an entity, so inside text it has to be written as &. The problem is not limited to titles such as "Hot & Cold Mug". It also hits URLs that carry more than one query parameter:

<!-- wrong -->
<link>https://store.example/p/1001?color=white&size=12</link>
<title>Hot & Cold Travel Mug 12 oz</title>

<!-- right -->
<link>https://store.example/p/1001?color=white&amp;size=12</link>
<title>Hot &amp; Cold Travel Mug 12 oz</title>

The alternative is to wrap the value in a CDATA section (<![CDATA[ ... ]]>), where special characters need no escaping. What matters more than the method is the place: escape in the code that writes the feed, for every value coming out of the database. If someone edits one product name in the store to say "Hot and Cold", the feed works only until the next product with an ampersand shows up. A single such product can take down the whole file.

2. Control characters XML will not accept

XML 1.0 allows only tab, line feed, carriage return and characters from U+0020 upward (apart from a few technical ranges). Other control characters, such as U+0007 or U+0000, are forbidden everywhere, CDATA and numeric references like &#7; included. They sneak into product descriptions when text is pasted from Word or a PDF, imported from a spreadsheet, pulled from an old database in another encoding, or cut in the middle of a multi-byte character.

The fix is to strip these characters at the moment the feed is written, with one function applied to every text field. On a single product the problem is invisible to the eye because the character displays nothing. The checker reports its line, column and code.

3. Whitespace before the declaration, byte order marks and encoding

The declaration <?xml version="1.0" encoding="UTF-8"?> must be the first thing in the file. A blank line or a space before it is an error, and it is usually caused by a template: a stray newline before an opening PHP tag or in an included file. A byte order mark at the start of a UTF-8 file is legal in XML, but when a feed is stitched together from several parts a BOM can end up in the middle of the file, and then the parser stops.

The encoding in the declaration should match the real one. The safest setup is UTF-8 along the whole chain: database, generator, file on disk and the server response header. A mismatch shows up as garbled accented characters or as an error at the first non-ASCII character.

4. A truncated file and duplicate ids

If feed generation is interrupted halfway (a timeout, out of memory, a process restart), you are left with a file that has no closing </channel> and </rss>. The parser reports an unexpected end of the file, and the size is clearly smaller than usual. The safeguard is simple: write to a temporary file, validate it with a parser, and only then swap it in for the file Google fetches.

Duplicate id values do not break the syntax, but they damage the data. An id should be unique in the feed and stable over time. When it repeats, Merchant Center treats the entries as the same product, so one of them may be skipped or overwrite the other. This usually happens with variants (size, color) exported without their own id, or when two data sources use the same numbering. Variants are tied together with item_group_id, and each variant gets its own id.

5. The attributes every product needs

The Merchant Center product data specification requires at least the attributes below for every product. A missing one means that item is disapproved:

AttributeWhat it must containTypical mistake
idA unique, stable identifier, up to 50 charactersRepeated across variants, or changed after a store update
titleThe product name, up to 150 charactersEmpty, or copied from another language version
descriptionPlain text description, up to 5,000 charactersMissing on products imported from a supplier
linkThe full product page URL, httpsA relative path, a redirect, or a link with a raw ampersand
image_linkThe product image URLEmpty for products without a photo, or a file that no longer exists
priceAmount and currency codeSee the next section
availabilityin_stock, out_of_stock, preorder or backorderA free-text value such as "available"

On top of these come attributes that depend on the product type (brand, GTIN, size for apparel), which this checker does not cover. For those, see Google's product data specification in Merchant Center Help.

6. Price format

Google expects a number with a period as the decimal separator, a space, and a three-letter currency code: 24.99 USD. Feeds exported from stores often arrive with a dollar sign ($24.99), a decimal comma (24,99 USD), a thousands separator (1,299.00 USD) or no currency at all. Each of those is a reason for rejection. In the United States the price in the feed should not include sales tax; tax is configured in your Merchant Center settings. A price that differs from the one on the product page triggers a mismatch even when the format is perfect.

What to do once you have found the error

  1. Fix it at the source. An edit to the file your store generated returns at the next export. Change the code that writes the feed: escape special characters, strip control characters, write to a temporary file first.
  2. Validate with a second tool. On a server, xmllint --noout feed.xml is enough: no output means the syntax is valid.
  3. Trigger a new fetch in Merchant Center and read the processing status of the data source. That is where you see whether Google accepted the file.
  4. Compare product counts from before and after the incident. If the number has not recovered, open diagnostics and read the reasons for single products.
  5. Add an automatic check after every generation: an XML parse, the product count against the previous file, and an alert on a sharp drop. The next failure should not be discovered through a dip in sales.

Products do not come back instantly after a fix: re-review time is set by Merchant Center. For big changes in the store, check the feed first and then publish it to Google.

Privacy: what happens to your file in the checker

The feed checker runs in your browser. The code that analyzes the feed is on the page and does not send the file to a server. You can confirm it in your browser tools: after you click "Check feed" the Network tab shows no request. You can also paste only the beginning of a file with a few products.

If your store sells in several countries, feeds per market need their own checks and their own ids; we describe how we set that up on the multi-country Google Ads page.

Frequently asked questions

Why does Merchant Center reject the whole feed instead of single products?

If the file is not valid XML, for example because of an unescaped ampersand or a truncated ending, Google cannot read it at all. A missing field or a wrong price affects single products, while a syntax error blocks the entire file.

Is it safe to paste my feed into the checker?

The checker runs only in your browser and does not upload the file. If you prefer, paste just the first part with a few products: the parser finds syntax errors the same way.

How should I escape an ampersand in a feed?

Do it in the code that writes the feed, for every value, either with an XML escaping function or by wrapping text in CDATA. A manual fix in the file comes back with the next export.

How long until products return after I fix the feed?

Trigger a new fetch in Merchant Center and watch the data source status. Re-review time is set by Google, so do not plan around a fixed number of hours.

Check your XML feed →

Attribute reference: Google Merchant Center product data specification. Questions for us: hello@leadsitelab.pro.

Get my free mockup