Skip to content

Sitemap XML errors: Parsing error, Missing XML tag, and more

These errors mean the sitemap file is not valid XML, or not in the sitemap format Google expects. Most come from a plugin or theme printing extra text, or from an unescaped &.

Search Console shows:Parsing errorInvalid XML: too many tagsMissing XML tagMissing XML attributeInvalid tag valueInvalid attribute valueUnsupported formatIncorrect namespaceLeading whitespace

By Bruno Amorim · ·

Where you see it

On a sitemap's details page in Indexing > Sitemaps, under Sitemap can be read, but has errors. Expand an error to see the line number.

What it means

Google downloaded the file but could not read all of it as a sitemap.

Search Console shows the line number for most of these errors. Start there.

Common causes

  • An unescaped special character in an address: & must be written &amp;. Quotes and < > need escapes too.
  • A theme or plugin prints spaces, blank lines, or PHP notices before <?xml.
  • The namespace is wrong, such as 0.9 written as .9.
  • A hand-made file with curly quotes from a word processor, or a duplicated tag.
  • The file is not saved as UTF-8. Google requires UTF-8 for sitemaps.

Find the cause

  1. Expand the error in Search Console and note the line number.
  2. Open the sitemap in your browser and View Page Source. Check that the first characters are <?xml.
  3. Run the file through an XML validator to find the exact line.

How to fix it

  1. Fix the line Search Console names, or the setting that builds it.
  2. If text comes before <?xml, turn plugins off one at a time to find the one that prints it.
  3. Use the namespace http://www.sitemaps.org/schemas/sitemap/0.9.
  4. Save or build the file as UTF-8.
  5. Resubmit the sitemap.

Each message and its fix

"Parsing error"

Google could not parse the sitemap's XML. Often an address has an unescaped character.

  • Escape &, ', ", <, and > in every value. For example, write & as &amp;.

"Invalid XML: too many tags"

The sitemap has duplicate tags, such as two <loc> tags in one <url>.

  • Remove the duplicate tag Search Console names, then resubmit.

"Missing XML tag"

An entry is missing a required tag. Search Console shows the line number.

  • Give every <url> a <loc>, and every <sitemap> in an index a <loc>.

"Missing XML attribute"

A tag is missing a required attribute.

  • Add the attribute, then resubmit.

"Invalid tag value"

A tag has a value that its sitemap type does not allow.

  • Check the value against the rules for your sitemap type: standard, index, image, video, or news.

"Invalid attribute value"

An attribute has a value that is not allowed.

  • Check the attribute for typos and use only allowed values.

"Unsupported format"

The sitemap is not in a supported format: a wrong header, a wrong namespace, or curly quotes around attributes.

  • Start the file with <?xml version="1.0" encoding="UTF-8"?>.
  • Use straight quotes around every attribute.

"Incorrect namespace"

The root element has a missing, wrong, or misspelled namespace.

  • Use xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" on <urlset> or <sitemapindex>.

"Leading whitespace"

The file starts with spaces or blank lines before the XML declaration. Google still reads the sitemap.

  • Remove the whitespace so the file starts with <?xml. Rank Math and similar plugins have guides for this.

See which of your pages Google skipped, and why. Free for up to 500 pages.

Get my free report

When you can ignore it

Leading whitespace does not stop Google from reading the sitemap. Fix it when you can, but it is not urgent.

On your platform

WordPress

On WordPress, extra text before <?xml usually comes from a theme's functions.php or a plugin. Turn plugins off one at a time, or switch to a default theme for a minute, and reload the sitemap. WordPress pages not indexed

Catch sitemap problems before they cost you pages

On paid plans, CrawlCoach downloads your sitemaps every day and reads Search Console's sitemap data for each fix list. When a sitemap stops loading, Search Console reports errors in it, or Google stops reading it, the fix goes in your fix list with the steps and a link to the right guide. See plans and prices.

Questions

How do I fix a sitemap parsing error?

Expand the error in Search Console to find the line. A common cause is an & in an address that is not written as &amp;. If a plugin builds the sitemap, update the plugin, or report the line to its developer.

How do I fix Missing XML tag?

A required tag is missing on the line Search Console shows. Every <url> needs a <loc> with the full page address. Every <sitemap> entry in an index needs a <loc> too.

What does Unsupported format mean?

Google could not read the file as a sitemap. Check the header and the namespace, and replace curly quotes with straight ones. A sitemap can also be an RSS or Atom feed, or a text file with one address per line.

Sources

Checked on October 8, 2026. Search Console's wording can change after that date.

See which of your pages Google skipped

Sign in with Google. CrawlCoach checks up to 500 pages for free and shows the fix for each problem.

Get my free report

Free for up to 500 pages. No card needed. Sign in with the Google account you use for Search Console.

Related sitemap errors

Related guides