Reference guide for resolving the most frequent configuration errors and warnings.
An HTML page is being served instead of XML
The URL returns a web page rather than a sitemap. Almost always this means the sitemap does not exist and the server is returning its 404 page with a 200 status.
The Fix: Confirm the sitemap URL, and make sure missing files return a real 404 rather than a page.
The sitemap has no XML namespace
The urlset element must declare the sitemaps.org namespace. Without it the file is not a valid sitemap and search engines reject it outright.
The Fix: Add the xmlns attribute to the root element.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
The XML namespace is wrong
The namespace must be exactly the sitemaps.org schema URL. A typo, or an http/https mismatch, invalidates the whole file.
The Fix: Set it to the exact string below — it is an identifier, not a link, so it does not change to https.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
An unescaped ampersand
A raw & is not legal in XML. One of them makes the entire document invalid, so every URL in the sitemap is lost, not just the offending line.
The Fix: Escape it as &. This is the most common sitemap syntax error and it comes from URLs with query strings being written out unescaped.
<loc>https://example.com/search?a=1&b=2</loc>
An invalid lastmod date
lastmod must be a W3C datetime. Anything else is ignored, so you lose the freshness signal the field exists to provide.
The Fix: Use YYYY-MM-DD, or a full ISO 8601 timestamp with a timezone.
<lastmod>2024-01-15</lastmod>
An entry with no loc element
Every <url> must contain exactly one <loc>. An entry without one describes nothing and is skipped.
The Fix: Add the missing <loc>, or remove the empty entry.
Duplicate URLs in the sitemap
Duplicates waste crawl budget and usually mean the sitemap is generated from a query that is not deduplicated.
The Fix: De-duplicate at generation time. Pay attention to URLs that differ only by trailing slash or query parameter.
Over the 50,000 URL limit
A single sitemap may contain at most 50,000 URLs and be at most 50MB uncompressed. Past that, it is rejected.
The Fix: Split it into several sitemaps and list them in a sitemap index file.
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://example.com/sitemap-1.xml</loc></sitemap>
<sitemap><loc>https://example.com/sitemap-2.xml</loc></sitemap>
</sitemapindex>