projectdiscovery/katana · error
could not get html content
Error message
could not get html content
What it means
newPageState fails when browser.Page.HTML() cannot return the page's outer HTML, even though page.Info() succeeded. This typically happens when the page navigated or was closed between the Info and HTML calls, or the DOM serialization failed in the browser.
Source
Thrown at pkg/engine/headless/crawler/state.go:78
outerHTML, err := page.HTML()
if err != nil {
return nil, errors.Wrap(err, "could not get html content")
}
state := &types.PageState{
URL: pageInfo.URL,
DOM: outerHTML,
NavigationAction: action,
Title: pageInfo.Title,
}
if action != nil {
state.Depth = action.Depth + 1
}View on GitHub (pinned to e3e742739c)
Solutions
- Verify the page is still open/attached; reopen or re-navigate if the tab was closed mid-crawl
- Retry page.HTML() once, as navigation races between Info() and HTML() are transient
- Log the wrapped cause to identify whether the renderer or CDP connection failed
- Return a non-fatal error so crawlFn can skip this state instead of aborting the crawl
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/engine/headless/crawler/state.go:78 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of projectdiscovery/katana@e3e742739c (2026-09-03).
Data as JSON: /api/errors/28ee7c61f3b9bfb3.
Report an issue: GitHub.