0

Google Sitemap tool tells me there are 2 errors at my sitemap: "Invalid URL - 2 instances" "This is not a valid URL. Correct the URL and submit the Sitemap again" "Examples"

URL:
Row 1
Parent Tag:
url
Tag:
loc

enter image description here No more info is provided.

I am 100% sure the URL is valid, I can reach it. Also, logs tell me that Googlebot itself is actually crawling that precise URL Url testing tool in search console also sees no errors on that url.

This is my sitemap first rows:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>
https://www.site.tld/post-slug/
</loc>
<lastmod>2021-06-06</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
[...]

What do I miss that I do not see?

2
  • Google doesn't always depend upon a sitemap to crawl a page. Google could have discovered the links in question from other pages linking to them. Two quick things to check: 1) Do the URLs have any special characters in them (some characters need to be escaped)? Ref: stackoverflow.com/questions/1091945/… 2) Is the XML valid? (you could search online for online XML validators.)
    – Kannan
    Jun 6, 2021 at 16:07
  • The url is plain Latin letters and the xml is valid, validated with xml-sitemaps.com/validate-xml-sitemap.html. I also removed the url in first row from Sitemap and it just throws the same error again. I removed all but the last url (which I know it digested well some months ago) and same error is throw
    – user118386
    Jun 6, 2021 at 16:49

1 Answer 1

1
  1. My XML did result valid when passed thru https://www.xml-sitemaps.com/validate-xml-sitemap.html
  2. Google told me as in initial post above seen: Invalid URL - 2 instances.
  3. Google went on bragging that the errors happen at Row 1 and presented empty examples.

This actually just means that anywhere inside your XML file, be it row one or 50k, you have an empty loc tag.

Google isn't able to detect if the tag is empty, broken or invalid. It just likes to throw the error, that's all, no further feedback.

Debugging this issue I also tried just out of curiosity to see what happens if you pass an empty XML file and the results are even worse. If you pass the following below, Google will tell you there is a missing XML tag.

<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"></urlset>

The thing is, the XML tag is pretty much there, nothing is missing at all, it is just not featuring any URL url yet.

This tool (Google SC) - while unfortunately an authoritative institution in the world of internet and the one deciding if your site dies or lives - is less than suboptimal. I would expect more from the tool that took the bold path of judging websites, indexing them or not, depending on their criteria. At least, a useful error messaging is expected. Not telling people where the error is, is simply mean and unprofessional.

Anyway, with this, the issue is solved and I hope it helps someone if they get that error. Do not trust 99% of the XML validators like https://www.xml-sitemaps.com/validate-xml-sitemap.html, as they won't see any error. Do not trust google either, because it will simply tell you an error happens on wrong line, and it will tell you the wrong cause of the error.

Manually check if you have EMPTY loc tag anywhere in the XML file. Only google will dare to complain this, but it will not pay off ignoring them since they dictate the faith of websites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.