lighthouse: web.dev consistently errors on Network.getResponseBody for main content
- run
node lighthouse-cli/index.js https://web.dev --only-categories best-practices --view
- get
Properly defines charset – Error!
(also happens in DevTools and PSI)

The error is
Required MainDocumentContent gatherer encountered an error: Protocol error (Network.getResponseBody): No resource with given identifier found
and occurs here in driver
when called from main-document-content
.
It seems unusual that the main document content wouldn’t be available for the backend. @robdodson does mention some unusual things done with the service worker and “an app shell that pulls in an index.json of the page content when you go to other pages. We essentially replace main content area with this new content” that could be causing trouble (maybe the request really didn’t have any content?).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 16 (6 by maintainers)
Ah thanks @thepassle that helps a lot! I think this is happening because Chrome might only keep the network resources from the current page load in the memory cache which is what Lighthouse relies on to get the response body of the root document. We can do a bit more digging but this is a great head start 👍
related #8984 #11027
We debugged a little bit more, we use a code snippet to reload the page when a new service worker has taken over:
❌ With that piece of code:
✅ Without that piece of code:
It seems that the reload is causing the best practices to error, hope that helps 🙂
EDIT:
In case anybody wants to workaround this, this seems to fix it. Also skips an unnecessary reload the first time a user visits your app (even though its so fast you might not have noticed)
The fix appears in version 11.1.0, PSI and the Chrome extension still use 11.0.0
@frankii91 The issue is not reproducible on that site
Running into this too for the first time today. I got scored 0 for “Best Practices” when analyzing this website: https://nrn-v2-mst-aptd-at-lcz-sty-c1-ah8bmgx1e.vercel.app/en
LH Report: https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Fnrn-v2-mst-aptd-at-lcz-sty-c1-ah8bmgx1e.vercel.app%2Fen#best-practices