Skip to content
Back to blog

GMC "Invalid value [gtin]" (invalid_upc): Fixes

Google reports Invalid value [gtin] (API code invalid_upc) when a barcode has the wrong length or check digit. How to find which, and fix it at the source.

Alex DiazFounder, SnowPipeMay 8, 20268 min read
google-merchant-centertroubleshootingproduct-feedsguide

The barcode scans at the register and your supplier confirms it, yet Merchant Center lists the product under Invalid value [gtin] with a value like this:

12345678905

Count the digits. There are eleven, and the UPC printed on the box is 012345678905, which has twelve. The leading zero went missing somewhere between your store and Google. Most of this post is about that gap: the barcode on the product is right, and the copy Google received is wrong.

If you would rather not test barcodes by hand, SnowPipe runs the check-digit test on every row before it sends anything to Google. What follows is the manual version.

The names this issue goes by

Google's help center calls it Invalid value [gtin], and its page on the issue describes it in one line: "This issue occurs when you've entered an invalid value for the GTIN [gtin] attribute."

API clients see a code instead. Google's Content API issue list gives the code invalid_upc with the text "Invalid value [gtin]" and the instruction "Use a globally valid UPC". The Content API was sunset on August 18, 2026. The Merchant API guide that replaced it shows the same problem as invalid_gtin, described as "Invalid GTIN". Which name you see depends on the tool that is reading the issue for you.

What Google accepts in gtin

The GTIN attribute page and the product data specification set the rules.

FormatDigitsGoogle's note
UPC (GTIN-12)128-digit UPC-E codes should be converted to 12 digits
EAN (GTIN-13)13
JAN8 or 13
ISBN13ISBN-10 is deprecated and should be converted to ISBN-13
ITF-14 (GTIN-14)14For multipacks

On top of the length, the specification asks for three things: the check digit is present and correct, the GTIN is not in a restricted range (GS1 prefixes 02, 04 and 2), and it is not a coupon (prefixes 98 and 99). Spaces and dashes are, in the attribute page's words, "accepted, but ignored", although the specification still tells you to leave them out.

Two neighbouring issues are easy to confuse with this one. A coupon-range value is reported as Unsupported GTIN. A GTIN that passes every format check but belongs to another product is reported as Incorrect GTIN, which Google says "tends to occur when the GTIN from another product is accidentally re-used". Neither is fixed by the steps below.

Checking a check digit by hand

The last digit of a GTIN is calculated from the others. GS1's method uses one table for GTIN-8, GTIN-12, GTIN-13 and GTIN-14: multiply the digits alternately by 3 and 1, with the digit next to the check digit taking the 3, add the results, and subtract the sum from the nearest equal or higher multiple of ten.

For a 12-digit UPC that puts the weight of 3 on the 1st, 3rd, 5th, 7th, 9th and 11th digits. Take 01234567890 and find its twelfth digit:

  1. Digits weighted 3: 0 + 2 + 4 + 6 + 8 + 0 = 20, and 20 * 3 = 60
  2. Digits weighted 1: 1 + 3 + 5 + 7 + 9 = 25
  3. Sum: 60 + 25 = 85
  4. Next multiple of ten is 90, so the check digit is 90 - 85 = 5

012345678905 is valid and 012345678906 is not. For single values, the GS1 check digit calculator does the same arithmetic.

Where the number gets damaged

A leading zero is dropped

Anything that treats the barcode as a number removes the zero at the front. Excel and Google Sheets do it when a cell is formatted as a number, and wide values may also be displayed in scientific notation. A database column typed as BIGINT does it. So does a script that parses the value as an integer on its way from JSON to the feed.

Store and send GTINs as text. In a spreadsheet, format the column as Text before pasting. In a database, use VARCHAR(14). In code, never pass the value through parseInt() or its equivalent.

The length changed in a conversion

A supplier sends a 13-digit EAN, someone assumes it should be a 12-digit UPC, and a digit is cut from the wrong end. Or an 8-digit UPC-E is sent as is, when Google wants it expanded to 12 digits. In both cases the length may still be one Google accepts while the check digit no longer matches.

Digits were retyped

012345678905 typed as 012354678905 fails the check. If a check digit is wrong, do not correct it by changing the last digit until the arithmetic works. The error can be anywhere in the number, and a value forced to validate is a valid GTIN for some other product. Get the number from the packaging or the manufacturer.

Characters that are not digits

Google says it ignores spaces and dashes. Its documentation says nothing about non-breaking spaces, zero-width characters and the other debris that comes with text copied out of a PDF price list, so strip everything that is not a digit before the value reaches the feed:

const cleanGtin = String(gtin).replace(/\D/g, '');
if (![8, 12, 13, 14].includes(cleanGtin.length)) {
  throw new Error(`GTIN length invalid: ${cleanGtin.length}`);
}

Finding the bad rows

In Merchant Center, go to Products, open the Needs attention tab, filter to the issue and use the download icon to export the affected products. Compare the value Google lists with the one in your store. If they differ, the damage happens in your export or feed tool. If they match, the store holds the wrong number.

Where to look in the store:

  • Shopify: the Barcode field on each variant.
  • WooCommerce: version 9.2 added a product field labelled "GTIN, UPC, EAN or ISBN" for products and variations. WooCommerce stores it as the _global_unique_id meta key. Older stores may keep the barcode under a plugin's own key instead:
SELECT post_id, meta_key, meta_value FROM wp_postmeta
WHERE meta_key = '_global_unique_id' OR meta_key LIKE '%gtin%';
  • BigCommerce: the upc and gtin fields on the product or variant.

For a whole feed file, a length check takes one command:

xsv select gtin feed.csv | tail -n +2 | \
  awk '{
    gsub(/[^0-9]/, "")
    len = length($0)
    if (len != 8 && len != 12 && len != 13 && len != 14)
      print "INVALID LENGTH:", $0, "(" len " digits)"
  }'

After you resubmit, Google says the change may take 24 to 72 hours to show on the Needs attention page.

Shortcuts that make it worse

Blanking the gtin on a product that has one makes this issue go away, and Google's identifier guidance says what replaces it: "Products with an assigned GTIN, but submitted without one, may have limited visibility."

Setting identifier_exists to no on a product that has identifiers is worse. The specification says not to, "or the product may be disapproved".

Buying or inventing a replacement number does not work either. Google's Incorrect GTIN page says: "Do not make up or create new GTINs." If you are the only seller of the product or it is a store brand, Google says it generally won't have a GTIN and you don't need to submit one. The missing GTIN guide covers what to send instead.

What SnowPipe does with a GTIN

SnowPipe sends products to Merchant Center through the Merchant API. Its default Google template maps the Shopify variant barcode to gtin and trims whitespace from both ends.

Before a row is sent, a non-empty gtin goes through the same tests described above: digits only, a length of 8, 12, 13 or 14, and the GS1 check digit. A row that fails is not sent, and the export's error summary counts it under the reason: non-numeric, wrong length, or failed check digit.

SnowPipe is stricter than Google on one point. A dash or space inside the number fails as non-numeric, where Google would ignore it. It also does not repair a value. A UPC that lost its zero is reported as the wrong length and left for you to correct in the store.

It does not test for restricted or coupon prefixes, and it cannot know whether a valid GTIN belongs to the product. Google still decides those.


Want the check digit tested before Google sees the row?

Try SnowPipe free: connect your store and get accurate Google/Facebook syncs in minutes. Or book a 15-min demo and I'll walk you through your specific setup.

Ready to automate your product feeds?

Connect your store and sync to Google, Facebook, and more — in minutes. No credit card required.