Skip to content
Nazmul Nikhil
Menu

robots.txt Is Not Valid (PageSpeed Insights)

PageSpeed checks your robots.txt for syntax errors and server errors. Here's what it flags, including unknown directives, and how to fix them.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
robots.txt Is Not Valid (PageSpeed Insights)
Photo: Sasun Bughdaryan on Unsplash

In short

PageSpeed fetches /robots.txt and flags lines it can't parse, and a server error (5xx) when fetching the file. It lists each bad line with the line number. Fix typos, put every rule under a User-agent line, and use full URLs for Sitemap. Note that Lighthouse treats directives it doesn't recognize as errors, so experimental lines (for example an Agentmap: line for AI agents) can make this check fail.

In passed form: "robots.txt is valid."

A 404 for robots.txt is fine (it means "no rules"); a 5xx is not, because Google may stop crawling.

The Semrush robots.txt article in this blog covers syntax in detail.

This guide isn't affiliated with or endorsed by Google.

Sources and references

TAGSPageSpeed InsightsRobots.txt is not validRobots txt errors lighthouseInvalid robots.txt
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with Technical SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Page Speed & Core Web Vitals posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com