Technical SEO guide

How to Find and Fix XML Sitemap Errors

Create a clean discovery signal containing only canonical, indexable URLs that your site genuinely wants search engines to process.

Professional monitoring workspace used to inspect XML sitemap errors
Photo by John Taran on Pexels.

A healthy XML sitemap is a precise inventory of canonical, indexable URLs, not a dump of every route a CMS can generate. Errors often reveal wider problems with redirects, canonicals, status codes, and publishing controls.

Inspect a public sitemap with ToolTrace's free XML Sitemap Checker.

Find errors in Google Search Console

Start in Google Search Console under Indexing then Sitemaps. The report lists every sitemap Google has processed, the submission status, and the discovered URL count. Red statuses point at the exact problem: Couldn't fetch means a 4xx or 5xx on the sitemap URL itself, Sitemap could be a HTML page means the server returned HTML instead of XML, and Parsing error flags malformed XML that must be fixed before anything else is useful.

Check robots.txt for a Sitemap: directive and compare it against what Search Console shows. The two should agree. Also check Bing Webmaster Tools, CMS plugins, and any sitemap index files for stale references. Verify each sitemap URL returns 200, uses the preferred HTTPS hostname, and does not require authentication. The Google Search Central sitemap overview lists every status message the Sitemaps report can emit. Validate the file with the free XML Sitemap Checker before resubmitting, since Search Console only recrawls on its own schedule.

Fix malformed XML and encoding

A sitemap must be well-formed XML in UTF-8, declare the correct namespace, and escape reserved characters. The minimum valid file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page/</loc>
    <lastmod>2026-10-14</lastmod>
  </url>
</urlset>

Four problems cause most parsing errors. A byte-order mark at the start of the file breaks the XML declaration, so save as UTF-8 without BOM. Unescaped ampersands inside URLs break parsing, so ?a=1&b=2 must appear as ?a=1&amp;b=2. A missing or wrong xmlns value, such as a typo in the schema URL or http where the spec says http literally, causes Google to reject the file silently. And a stray non-UTF-8 character inside a <loc>, often from a copy-pasted smart quote in a slug, triggers the Parsing error status without pointing at the line.

Google's build and submit a sitemap page documents every required element and encoding rule.

Respect size and URL count limits

Each sitemap file is capped at 50,000 URLs and 50 MB uncompressed. Both limits apply at once, so a sitemap with 30,000 verbose entries can hit the size cap before the URL cap. Gzip is supported and the 50 MB ceiling is measured on the uncompressed file, not the .xml.gz served over the wire.

When either limit is approached, split the file by section or publication date and reference the parts from a sitemap index. Posts, pages, products, and categories each get their own file. Keep each child file comfortably under the ceiling, around 40,000 URLs, so a bulk import does not push a sitemap over the limit between generations.

Oversized files trigger the Sitemap is too large status in Search Console and the whole file is ignored, not truncated. The manage large sitemaps guide covers the split-and-index pattern. Use ToolTrace's XML Sitemap Generator if your CMS cannot produce a split sitemap on its own.

Fix invalid URLs, redirects, 404s, and 5xx

Every URL in a sitemap should return a final 200 at its canonical address. Google's coverage report flags the common failures by name. Submitted URL not found (404) means a page was removed but the sitemap still lists it. Submitted URL has crawl issue covers 5xx responses, DNS failures, and timeouts. Submitted URL seems to be a Soft 404 appears when a thin or empty page returns 200 but reads as missing content.

Redirects deserve their own fix. A URL that 301s to its canonical should be replaced in the sitemap with the final destination, not left as the redirect source. Chains of two or more hops waste crawl budget and often appear as Page with redirect in the coverage report. Resolve each entry to its last hop before submission.

Fix the generator, not the output file. A CMS that regenerates the sitemap on every publish will overwrite manual edits within hours. Patch the query that selects URLs so deleted, draft, and redirected posts are excluded at source. Run the XML Sitemap Checker after any template change to confirm the output still contains only live canonical URLs.

Resolve canonical conflicts

A sitemap should list the canonical version of each page and nothing else. Common conflicts show up in Search Console as Duplicate, Google chose different canonical than user and Alternate page with proper canonical tag. Both mean the sitemap is advertising a URL whose own rel="canonical" points somewhere else.

Three mismatches cause most of these. Protocol: the sitemap uses http while the canonical and HSTS header use https. Hostname: the sitemap uses the bare domain while the canonical uses www, or the reverse. Trailing slash and case: /Blog/Post and /blog/post/ are different URLs to a crawler even when the server treats them as the same page.

Audit the sitemap against the canonical tag emitted on each page. The XML Sitemap Checker flags entries whose <loc> does not match the canonical returned by the live page, which is the fastest way to catch a CMS that writes https://www in metadata but https:// in the sitemap. Fix the mismatch in the template that generates URLs so every internal link, canonical tag, and sitemap entry agrees. One source of truth stops the conflict from recurring on the next deploy.

Fix noindex vs sitemap conflicts

A sitemap is a crawl hint; noindex is an indexing directive. Including a noindex URL in a sitemap sends a mixed signal and triggers the Submitted URL marked 'noindex' warning. Google will drop the page from the index and the sitemap entry is wasted.

The directive can live in three places. A meta tag in the HTML head: <meta name="robots" content="noindex">. An HTTP response header: X-Robots-Tag: noindex, often set at the CDN or app server for PDFs, filtered category pages, and staging mirrors. And a plugin setting on individual posts, which bypasses the template and surprises people who only check the raw HTML.

Decide the intent per URL. If the page should be indexed, remove the noindex. If it should not, remove the sitemap entry. Both must agree. A separate failure mode is a robots.txt block on a URL that is also listed in the sitemap: the crawler cannot read the page to see its canonical or indexing signals. The blocked by robots.txt guide walks through that specific case, and the robots.txt Tester confirms the current rules.

Keep lastmod honest

The <lastmod> element should reflect a real content change on the page, not the time the sitemap was generated. Google states that lastmod is used as a hint only when the value is trustworthy across the whole sitemap. A file where every entry carries today's timestamp is ignored, taking the actual signal with it.

Use W3C datetime format: 2026-10-14 for date-only, or 2026-10-14T09:30:00+00:00 with a timezone offset when time precision matters. Pull the value from the page's last meaningful edit, the same source that drives dateModified in Article or BlogPosting JSON-LD. A navigation tweak or sidebar widget change should not touch it.

If the CMS cannot produce a trustworthy value, omit the element entirely. An absent lastmod is better than a lie. For large catalogs, cache the last edit timestamp per URL in the database rather than relying on filesystem metadata, since a redeploy will reset file mtimes and make every URL look freshly updated at once.

Use a sitemap index properly

A sitemap index is a sitemap of sitemaps, used when a single file would exceed the 50,000 URL or 50 MB cap or when logical separation helps. The index uses a different root element and a different schema reference:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-posts.xml</loc>
    <lastmod>2026-10-14</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-products.xml</loc>
    <lastmod>2026-10-14</lastmod>
  </sitemap>
</sitemapindex>

Three rules keep an index healthy. Each child sitemap URL must sit on the same host as the index itself; cross-domain references are rejected. An index can list up to 50,000 child sitemaps, and the children can themselves be gzipped. And do not nest an index inside another index, because Google only follows one level.

Submit the index URL in Search Console, not the children. Google will discover each child from the index and report its status individually. If a child file fails parsing, the rest still process, which makes an index safer than one monolithic file for a large site.

Image, video, and hreflang sitemaps

Standard sitemaps carry URLs. Specialised namespaces extend them with image, video, and language metadata. Each adds a separate xmlns declaration on the <urlset> root.

Image sitemaps use xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" and nest up to 1,000 <image:image> entries per <url>. Only include images Google can crawl at the given URL. The image sitemap reference documents the full element list.

Video sitemaps use xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" and require video:thumbnail_loc, video:title, and video:description at minimum. Match the metadata to what the embedded player actually shows, since Google compares the two before granting video rich results.

Hreflang in sitemaps uses xmlns:xhtml="http://www.w3.org/1999/xhtml" and <xhtml:link rel="alternate" hreflang="..."> entries. Every language variant of a URL must list every other variant, including itself with a self-referential entry. Omitting the self-reference breaks the cluster. The localized versions guide covers the exact pairing rules.

Submit, verify, and monitor

Submit the final sitemap URL in Search Console under Indexing then Sitemaps. The old ping endpoint at google.com/ping?sitemap= was retired in 2023, so manual submission or the robots.txt Sitemap: directive is now the only reliable path. Bing Webmaster Tools has an equivalent form.

After submission, confirm two things on the Sitemaps report: the status reads Success, and the discovered URL count matches the number of canonical URLs the site actually publishes. A count that is far too low points at a filter in the generator; a count that is far too high points at duplicate or non-canonical entries sneaking in.

Monitor the sitemap on a schedule rather than only after regressions appear. Automate checks for XML validity, HTTP status on each entry, canonical mismatch, noindex conflicts, and sudden URL count swings between generations. The XML Sitemap Checker covers one-off runs, the XML Sitemap Checker API fits a CI pipeline, and a quarterly on-page SEO audit catches the drift that per-URL monitoring will not. Treat the sitemap as a surface worth watching, not a file to generate and forget.

Triage sitemap errors by consequence

Separate transport and syntax failures from URL-quality warnings. An unreachable or malformed sitemap can stop processing entirely. A redirected or non-canonical URL weakens the file but does not invalidate every other entry.

  1. Confirm the sitemap URL returns 200 with an expected XML content type.
  2. Repair malformed XML, namespaces, encoding, and sitemap-index references.
  3. Remove redirects, errors, blocked pages, non-canonical pages, and intentional noindex URLs.
  4. Keep only canonical, indexable URLs the site wants discovered.
  5. Split files before protocol limits and keep index references current.

Use the XML Sitemap Checker to inspect the live file and its sampled URLs.

Monitor sitemap quality after deployment

Generate sitemaps from the same canonical URL inventory used by routing and publishing systems. Do not maintain a separate hand-edited list that drifts from production. Update lastmod only when meaningful page content changes.

Track fetch failures, submitted versus indexed trends, redirect and error counts, excluded canonical URLs, orphaned sitemap URLs, and URLs missing from the file. Submit sitemap indexes through Google Search Console and Bing Webmaster Tools, then investigate patterns rather than assuming submission guarantees indexing. Pair the review with the SEO Page Inspector for page-level evidence.

Common failure patterns and how to diagnose them

Start with the earliest failing layer. If a request does not return the expected page, inspect DNS, redirects, HTTP status, content type, firewall behavior, and access controls before changing extraction or metadata rules. If the correct document arrives but the result is empty, compare initial HTML with the rendered page and determine whether JavaScript supplies the missing information.

When only some fields are wrong, inspect the page source and identify which signal produced each value. A stale canonical, duplicated title, malformed JSON-LD block, relative URL, or CMS fallback should be corrected at its source. Avoid adding a special case for one URL when the same template defect affects a wider section of the site.

Finally, distinguish a deterministic failure from a recommendation. Invalid JSON, an unreachable URL, or a conflicting index directive can be proven. Content usefulness, ideal wording, and business priority still require human judgment. A professional report should show the evidence, explain the consequence, and avoid presenting a heuristic as a universal rule.

Production quality checklist

Validate the exact production URL, not only a CMS preview, local fixture, or isolated code sample. Confirm the requested URL, final URL, HTTP status, content type, and visible result agree with the page you intended to process. Test at least one normal case, one sparse page, one redirected URL, and one expected failure so the interface communicates limitations clearly.

  • Keep source URLs and observation times with exported results.
  • Use descriptive labels, headings, and error messages.
  • Specify image dimensions and keep media files lightweight.
  • Test keyboard access and narrow mobile layouts.
  • Separate automatic checks from recommendations requiring judgment.
  • Respect access controls, publisher policies, privacy, and applicable law.

After deployment, rerun the workflow against representative URLs and monitor for changes in output size, missing fields, status codes, response time, and template behavior. Keep a known-good result for comparison. When a check fails, fix the source template or data pipeline rather than hiding the warning in the interface.

Frequently asked questions

What does 'Couldn't fetch' mean in the Sitemaps report?

Google tried to retrieve the sitemap URL and received a 4xx, 5xx, timeout, or DNS failure. Open the URL in a private browser and confirm it returns 200 over HTTPS without authentication, then resubmit.

Can I include non-canonical URLs in a sitemap?

No. Only list URLs whose own rel=canonical points at themselves. A non-canonical entry will trigger a Duplicate or Alternate warning and wastes the slot that a canonical URL could use.

Does gzipping a sitemap change the 50 MB limit?

No. Gzip is supported for transport, but the 50 MB cap is measured on the uncompressed file. A .xml.gz served at 8 MB can still be rejected if the raw file exceeds the ceiling.

Should every page on the site be in the sitemap?

Only canonical, indexable pages. Exclude login screens, cart URLs, filter variants, thin tag archives, and anything marked noindex. The sitemap is an inventory of pages you want crawled, not every route the server responds to.

Do I need to resubmit the sitemap after every update?

No. Google refetches submitted sitemaps on its own schedule, usually within a day for active sites. Resubmit manually only after a structural change such as a new URL pattern, a hostname migration, or a fix to a prior parsing error.

Can one sitemap list URLs from multiple hostnames?

No. Every URL in a sitemap must share the hostname of the sitemap file itself. Use a separate sitemap per verified property, or move to a single canonical hostname and 301 the rest.

How quickly does Google reprocess a fixed sitemap?

The Sitemaps report usually updates within hours of the next fetch, but coverage changes for individual URLs can take days as Google recrawls each page and reconciles the new signals.