By SitemapFixer Team
Updated October 2026

Sitemap Parsing Errors: Parsing Error, Missing XML Tag, Incorrect Namespace and More

Check that your sitemap parses and its URLs workCheck My Sitemap

Short answer: Search Console could fetch your sitemap but found something in the XML it couldn’t read. The Sitemaps report names the exact error. Most come down to four things: the file isn’t well-formed XML (often a raw &), something is printed before <?xml, the namespace is wrong, or an entry is missing <loc>. Fix it in the tool that writes the sitemap, check the file, and resubmit it.

Where you see these errors

Open Indexing → Sitemaps in Search Console and click the sitemap. If its status is “Has errors”, the details page says “Sitemap can be read, but has errors” and lists each error. If Google couldn’t get the file at all, that’s a different problem: see Couldn’t fetch and could not be read.

Every parsing error and its fix

Error names and meanings are from Google’s Sitemaps report help:

Parsing error

Google could not parse the sitemap’s XML.

The file is not well-formed XML: an unclosed tag, an unescaped & in a URL, or HTML mixed into the file. Open it in a browser or run it through xmllint to see the first broken line.

Leading whitespace

The sitemap starts with whitespace instead of the XML declaration.

Remove every space, blank line or invisible byte before <?xml. A blank line printed by a PHP file or plugin before the output is a common cause.

Incorrect namespace

The root element doesn’t have the correct namespace.

Use exactly xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" (http, not https, with no typo).

Missing XML tag

An entry is missing a required tag.

Every <url> needs a <loc>; every <sitemap> in an index needs a <loc>. Look for empty entries a generator wrote for deleted content.

Missing XML attribute

A tag is missing a required attribute.

Usually in an extension, such as an hreflang <xhtml:link> without rel, hreflang or href.

Invalid XML: too many tags

The sitemap contains duplicate tags.

An entry has a tag twice, such as two <loc> or two <lastmod> in one <url>. Keep one.

Invalid tag value

A tag holds a value that isn’t allowed.

For example changefreq "biweekly" or priority "2". Use a valid value or remove the tag.

Invalid date

One or more dates are invalid.

lastmod must use W3C Datetime: 2026-10-13 or 2026-10-13T09:30:00+00:00. Not 10/13/2026.

Unsupported format

The sitemap is not in a supported format.

Google reads XML sitemaps, RSS 2.0, Atom 1.0 and plain-text URL lists. A JSON file or an HTML page is not one of them.

A valid sitemap to compare against

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/shop?cat=1&amp;page=2</loc>
    <lastmod>2026-10-13</lastmod>
  </url>
</urlset>

Note the first line starts at the very first byte, the exact namespace, and &amp; instead of a raw &. Full tag rules are in our XML sitemap format guide.

How to find the broken line

# download and validate (prints line and column of the first error)
curl -s https://example.com/sitemap.xml -o sitemap.xml
xmllint --noout sitemap.xml

# show any bytes before "<?xml" (should print nothing)
head -c 100 sitemap.xml | od -c | head -3

If the second command shows a blank line, spaces or the bytes 357 273 277 (a byte order mark) before <, that’s your leading-whitespace problem.

Fix it at the source, then resubmit

  1. Plugin or CMS sitemaps: update the plugin, and look for a theme file or another plugin that prints output before the sitemap. Don’t hand-edit a file that gets regenerated.
  2. Custom code: build the XML with a library or escape every value, and send the response with Content-Type: application/xml.
  3. Hand-written files: save as UTF-8, validate with xmllint, then upload.
  4. Resubmit the sitemap in the Sitemaps report and check that the status changes to Success.

The free sitemap checker confirms the file is a real sitemap (it must contain <urlset> or <sitemapindex>) and tests 30 of its URLs live.

Frequently asked questions

What does "Sitemap can be read, but has errors" mean?

Google fetched and partly read the file but hit errors in it. Open the sitemap in the Sitemaps report to see each error, then fix them in the file or the tool that writes it.

How do I find the exact line with the XML error?

Run xmllint --noout on the file. It prints the line and column of the first problem. Most browsers also show an XML error and the line when you open a broken sitemap.

Why does a raw & break my sitemap?

In XML, & starts an escape code. A URL like ?a=1&b=2 must be written as ?a=1&amp;b=2 inside the sitemap, or the file is not valid XML.

My sitemap is generated by a plugin. Where do I fix it?

In the plugin or theme, not by editing the output. Leading whitespace often comes from a theme or another plugin printing a blank line; disable plugins one at a time to find it.

Is your sitemap readable?
Free - reads your sitemap and tests 30 URLs live
Check My Sitemap Free

Related guides