sfw/fix
hreflang: Unknown language code medium

Hreflang 'Unknown Language Code' Error

An hreflang value uses an invalid code — a region with no language, a made-up code, or reversed order — so the annotation is dropped.

What you see

International Targeting > Language
Your site has no hreflang tags / Unknown language code
hreflang="uk" -> interpreted as Ukrainian, not United Kingdom
hreflang="en-UK" -> invalid region

What’s actually happening

A crawler or the legacy International Targeting report flags an hreflang value as an unknown or invalid code, and Google quietly discards that annotation. The classic trap: someone writes hreflang="uk" meaning the United Kingdom — but 'uk' is the ISO 639-1 code for Ukrainian, so the UK page gets tagged as a Ukrainian-language page. Equally common is hreflang="en-UK" (the UK region code is GB, not UK) or a reversed pair like 'GB-en'. The page still loads fine; it just gets served to the wrong audience or none.

Common causes

  • A region code used where a language belongs — hreflang="uk" (Ukrainian) or hreflang="eu" intending United Kingdom or Europe.
  • Wrong region token: 'en-UK' instead of 'en-GB' ('UK' is not a valid ISO 3166-1 country code — Great Britain is GB).
  • Reversed order — 'GB-en' or 'US-en' instead of language-then-region 'en-GB' / 'en-US'.
  • A made-up or non-standard code ('en-EU', 'es-LATAM', 'zh-CN-Hans' jammed together) that doesn't map to ISO 639-1 + ISO 3166-1 Alpha-2.
  • An underscore instead of a hyphen ('en_US') or trailing whitespace from a CMS field, so the parser can't read the code.

How to fix it

  1. Use the language-region format, in that orderThe value is ISO 639-1 language, optionally a hyphen and an ISO 3166-1 Alpha-2 region: en, en-GB, en-US, fr-CA, pt-BR, es-MX. Language is required; region is optional and always second. There is no such thing as a region-only hreflang.
  2. Fix the codes people always get wrongUnited Kingdom is en-GB, not en-UK and not 'uk' (that's Ukrainian). Latin America has no ISO region code — target individual countries (es-MX, es-AR) or use plain 'es'. Europe is not a country code either; use 'x-default' for a fallback/selector page, not 'en-EU'.
  3. Add x-default for the fallbackInclude <link rel="alternate" hreflang="x-default" href="..."/> pointing at your language-selector or default page. It's the only non-ISO value hreflang accepts, and it tells Google what to serve when no locale matches.
  4. Validate every code against the standardsRun the set through an hreflang tag validator or Screaming Frog's hreflang report — both flag unknown codes by row. Cross-check questionable codes against the ISO 639-1 language list and ISO 3166-1 Alpha-2 country list rather than guessing from the country's everyday abbreviation.
  5. Re-crawl to confirm the codes resolveAfter correcting the values, recrawl and confirm zero 'unknown language code' / 'invalid' rows. The International Targeting report is being retired, so a crawler (Screaming Frog, Ahrefs, Sitebulb) is the dependable check going forward.

Stop it recurring

Drive hreflang from a single locale map keyed to validated ISO 639-1 + ISO 3166-1 codes so a hand-typed 'en-UK' can never reach a template.

Related errors