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 &.
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&. 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.9written 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
- Expand the error in Search Console and note the line number.
- Open the sitemap in your browser and View Page Source. Check that the first characters are
<?xml. - Run the file through an XML validator to find the exact line.
How to fix it
- Fix the line Search Console names, or the setting that builds it.
- If text comes before
<?xml, turn plugins off one at a time to find the one that prints it. - Use the namespace
http://www.sitemaps.org/schemas/sitemap/0.9. - Save or build the file as UTF-8.
- 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&.
"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 reportWhen 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 &. 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 reportFree for up to 500 pages. No card needed. Sign in with the Google account you use for Search Console.
Related sitemap errors
- Has errorsHas errors means Google downloaded your sitemap but found problems in it. Google still uses the addresses it could read. Click the sitemap to see each error, then fix them in the file.
- Invalid dateInvalid date means a <lastmod> date in your sitemap is in the wrong format, or is not a real date. Use 2026-10-08, or a full time with a time zone.
- Sitemap is HTMLSitemap is HTML means the address you submitted returns a web page, not a sitemap file. Submit the XML file instead, or find what replaces it with a page.