DEV Community

SitePostmortem editor
SitePostmortem editor

Posted on Edited on Originally published at sitepostmortem.com

Sitemap could not be read: what six site audits showed, and the one command that names your cause

Search Console gives one message — "Sitemap could not be read" — to every failure downstream of "Google fetched the URL and could not parse a sitemap out of it". That is why "resubmit and wait" appears to work for some people and does nothing for the rest: they were never in the same failure.

I audited six small static sites in late October 2026. Four of the six had a real sitemap problem, and they were not the same problem:

  • 1 site had its sitemap generated by a pages.dev preview build, so 100% of the <loc> entries named the preview host — which serves x-robots-tag: noindex. The XML parsed perfectly and every URL in it was rejected.
  • 1 site had no sitemap file at all: /sitemap.xml answered 200 text/html with its 404 page, because the host rewrites misses into the app shell.
  • 2 sites had apex domains that did not answer over HTTPS, so the sitemap URL never resolved to anything.
  • 2 sites were fine — Google read their sitemaps without complaint.

One message, three different shapes in a sample of six. So run one command before changing anything:

curl -sS -o sitemap.xml -w '%{http_code} %{content_type}\n' https://example.com/sitemap-index.xml
head -c 300 sitemap.xml; echo
Enter fullscreen mode Exit fullscreen mode

Three outcomes, three different next steps:

Output What it means
200 text/html The file is not there; the host served a fallback page. A 200 is not evidence that a file exists.
404 text/html The file is genuinely missing — usually a build output path mismatch.
200 application/xml The file exists. The problem is inside it: hosts, child sitemaps, or malformed XML.

Cause 1 — the index points at a child that no longer exists

Static generators name child sitemaps by position: sitemap-0.xml, sitemap-1.xml. When the page count changes, a child can be renamed or dropped while the index still advertises the old name.

curl -s https://example.com/sitemap-index.xml | grep -o '<loc>[^<]*' | sed 's/<loc>//'
Enter fullscreen mode Exit fullscreen mode

Fetch each URL that prints. A 404 on the child is your cause, and it is invisible in the index file itself.

Cause 2 — the sitemap lists another host

A sitemap may only list URLs on the host that serves it. Preview deployments make this easy to get wrong: the preview build writes its own sitemap, someone copies that file to the custom domain, and every <loc> still names the preview host.

curl -s https://example.com/sitemap-0.xml | grep -o '<loc>[^<]*' | head -3
Enter fullscreen mode Exit fullscreen mode

If the first three lines name a domain you did not submit, stop. No resubmission fixes content that points elsewhere.

Cause 3 — robots.txt, a challenge, or a redirect sits in front of the file

A Disallow on the sitemap path, or a WAF challenge in front of XML, produces the same message: Google fetched and got something that is not a sitemap. Check the body with Googlebot's user agent, not just the status code:

curl -sS -A 'Googlebot' -o - https://example.com/sitemap.xml | head -c 200
Enter fullscreen mode Exit fullscreen mode

A challenge page, a redirect to a login, or an empty body all read as unreadable.

Cause 4 — the XML is broken, or over the documented limits

Google documents 50 MB uncompressed / 50,000 URLs per file, UTF-8 encoding, and a required <urlset> or <sitemapindex> root. A stray BOM, an unescaped & in a URL, or whitespace before the XML declaration is enough to fail the parse while the file looks fine in a browser.

curl -s https://example.com/sitemap-0.xml | python3 -c 'import sys,xml.dom.minidom as m; m.parseString(sys.stdin.read()); print("parsed ok")'
Enter fullscreen mode Exit fullscreen mode

What resubmitting actually does (measured)

I timed this on my own site. I re-submitted sitemap-index.xml through the Search Console API at 10:21:53. At 10:22 — 58 seconds later — a URL that had been reported as "unknown to Google" came back as "Discovered – currently not indexed", and the sitemap entry showed errors: 0, warnings: 0 with a fresh lastDownloaded.

Two things follow, and they change how you spend the next hour:

  1. Resubmitting restores the association. If the URL is not linked from anywhere else, this is the cheapest thing that changes anything.
  2. Resubmitting does not buy a crawl, and a crawl does not buy an index entry. On the same site, six URLs I requested for indexing were crawled within two to four minutes — and zero of them were indexed. A readable sitemap gets a URL into the queue; it says nothing about the verdict that follows.

That is the distinction the message hides. "Could not be read" is about the file. Whether the pages are then kept is a separate, site-level judgement, and no sitemap edit touches it.

The order I use

  1. content_type, not status code.
  2. Hosts inside the file, not the host you submitted.
  3. Child sitemaps, not the index.
  4. XML parse, last — it is the rarest of the four.

Two minutes, four commands, and you know which failure you have before you edit anything.


Full write-up with the six-site table: sitemap could not be read. If your URL is stuck one step later — known but never fetched — the per-URL counts from my own 56 URLs are on discovered, not indexed.

Top comments (0)