Guide

XML Sitemap Errors: Every Common Failure and Its Fix

Nine failures cause almost every broken sitemap. Here is how to recognize each one from its symptom and fix it for good.

By WebDoctor editors·16 July 2026·4 min read


Almost every broken XML sitemap fails in one of nine ways: a wrong namespace, unescaped characters, relative URLs, malformed lastmod dates, blown size limits, a URL that no longer returns XML, cross-host entries, conflicts with robots.txt, or a fetch failure in Search Console. Each has a distinct symptom and a fix you can apply in minutes.

1. Wrong or missing namespace

The root element must declare the sitemap protocol namespace exactly:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

Common variants that fail: the old 0.84 namespace from pre-2008 generators, https instead of http in the namespace URL, or no xmlns attribute at all. Parsers treat the namespace as an identifier, not a link, so it must match character for character. Copy it verbatim from sitemaps.org.

2. Unescaped characters in URLs

XML reserves five characters. A raw ampersand in a query string is the classic killer: the parser hits ?page=2&sort=new and aborts with a syntax error. Escape them in every <loc>:

  • & becomes &amp;
  • < becomes &lt; and > becomes &gt;
  • " becomes &quot; and ' becomes &apos;

3. Relative or scheme-less URLs

Every <loc> must be absolute, scheme included: https://example.com/page/. Paths like /page/ or protocol-relative forms like //example.com/page/ are invalid. Search engines will not guess the host for you.

4. Invalid lastmod dates

The <lastmod> field takes W3C datetime format only: 2026-07-16 or 2026-07-16T09:30:00+00:00. Regional formats like 16/07/2026, Unix timestamps and RFC 822 dates all fail validation. Two subtler problems: dates in the future, and setting every URL's lastmod to the build time of the sitemap. Google has said it uses lastmod only when it is consistently accurate, so a sitemap where 50,000 pages all "changed" at 3 a.m. today teaches Google to ignore the field entirely.

5. Too many URLs or too many bytes

The protocol caps a single sitemap at 50,000 URLs and 50 MB uncompressed. Past either limit, behaviour is undefined: some crawlers truncate, some reject the file. The fix is to split the sitemap and list the parts in a sitemap index. Gzip compression shrinks the transfer but does not change the 50 MB uncompressed limit.

6. The sitemap URL no longer returns XML

A sitemap must answer HTTP 200 with an XML body. Frequent offenders: the URL 404s after a site migration, a redirect chain ends at the homepage, or an error page is served as HTML with a 200 status. That last one is sneaky because the file "loads" in a browser. Check the response's content type and first bytes, or simply run it through the validator, which reports exactly what came back.

7. URLs on a different host

URLs in a sitemap should live on the same host, scheme included, as the sitemap itself. A sitemap at https://example.com/sitemap.xml that lists https://www.example.com/... URLs mismatches on the www prefix, and crawlers ignore those entries unless the sitemap is declared in the other host's robots.txt. Pick one canonical host and use it everywhere.

8. Sitemap contradicts robots.txt or noindex

A sitemap says "please crawl these"; robots.txt disallow rules and noindex tags say "stay out". When both apply to the same URL, you burn crawl budget and generate Search Console warnings. Audit the overlap: the sitemap should list only pages that are canonical, indexable and open to crawling.

9. "Couldn't fetch" in Google Search Console

This status usually means one of: the URL was submitted with a typo, robots.txt blocks the sitemap file itself, the server rejects Googlebot by user agent or IP, or the response times out. It also appears for a few hours right after first submission, so give a fresh sitemap a day before debugging.

Symptom to fix, at a glance

SymptomLikely causeFix
Parser rejects the whole fileMissing namespace or unescaped &Fix the xmlns declaration; escape URLs
Some URLs silently ignoredRelative URLs or cross-host entriesAbsolute URLs on one canonical host
"Invalid date" warningsNon-W3C lastmod formatUse YYYY-MM-DD or full ISO 8601
File accepted, crawl unchangedlastmod stamped with build timeEmit real modification dates
Sitemap works in browser, fails in GSCHTML error page with 200 statusServe real XML with content-type
"Sitemap too large"Over 50,000 URLs or 50 MBSplit and add a sitemap index
"Couldn't fetch"robots.txt block, typo, timeoutTest the exact URL; unblock the file

The fastest way to find which of the nine you have: run the file through the free sitemap validator. It parses your sitemap the way a crawler does and points at the exact entry that fails.

SitemapsTroubleshooting

Frequently asked questions

How do I know if my sitemap is valid?
Run it through a validator that checks the sitemaps.org protocol: XML syntax, namespace, URL format, lastmod dates and size limits. A file that opens fine in a browser can still be invalid, because browsers are far more forgiving than crawlers.
Do sitemap errors hurt rankings?
Not directly. A broken sitemap does not penalize you; it just stops helping. Pages get discovered later or not at all, crawl budget goes to stale URLs, and on large sites that indirect cost is real.
Why does Search Console say my sitemap has errors when it validates fine?
Search Console also evaluates each listed URL: redirects, 404s, noindex tags and robots.txt blocks. The XML can be perfectly valid while the URLs inside it have crawl problems. Fix the file first, then work through the per-URL reports.
Should lastmod change on every deploy?
No. Set lastmod to the date the page content genuinely changed. Stamping every URL with the deploy time trains Google to distrust the field, and Google has stated it ignores lastmod when it is not consistently accurate.

Run a check

Keep reading