Invalid sitemap URL medium
robots.txt: "Invalid sitemap URL detected; syntax not understood"
The Sitemap line in robots.txt uses a relative or protocol-less path, but the directive requires a full absolute URL, so Google ignores it.
What you see
Sitemap: /sitemap.xml Invalid sitemap URL detected; syntax not understood
What’s actually happening
Open robots.txt in the Search Console robots.txt report (or any validator) and the Sitemap line is underlined with "Invalid sitemap URL detected; syntax not understood." The site still serves and the sitemap file itself is valid — the problem is purely the reference. Google's parser requires the Sitemap directive to be a fully qualified absolute URL with scheme and host. A relative path or a bare domain doesn't parse, the line gets discarded, and that discovery path for your sitemap is silently gone.
Common causes
- Relative path: Sitemap: /sitemap.xml — no protocol or host
- Missing scheme: Sitemap: example.com/sitemap.xml — host but no https://
- A trailing comment or stray character on the same line as the URL
- Wrong protocol or host vs. the canonical site (http:// when the site is https://, or a non-matching subdomain that 301-redirects)
- Invisible junk in the file — a UTF-8 BOM at the top, smart quotes, or non-printable characters that corrupt the line
How to fix it
- Write the directive as a full absolute URLChange it to the complete address including protocol and host: Sitemap: https://example.com/sitemap.xml. The host doesn't have to match the robots.txt host, but the scheme and host must be present and correct.
- Put Sitemap on its own clean lineThe directive is independent of any user-agent group — keep it on its own line with nothing after the URL. Strip trailing comments, trailing whitespace, and anything following the URL on that line.
- Check the file's encodingSave robots.txt as plain UTF-8 without a BOM. A BOM or smart quotes (curly “ ”) can poison the first directive. View the raw bytes if a line looks correct but still fails — an invisible character is usually the culprit.
- Re-test and resubmitReload robots.txt in the Search Console robots.txt report to confirm the warning is gone, then submit the sitemap URL directly in the Sitemaps report so discovery doesn't depend only on robots.txt.
Stop it recurring
Always reference sitemaps by absolute URL and lint robots.txt in CI so a relative path never ships.
Related errors