projectdiscovery/katana · error

could not normalize dom

Error message

could not normalize dom

What it means

getStrippedDOM throws when domNormalizer.Apply cannot normalize the given HTML contents. It is a thin validation/transform helper over the normalizer; the faulting input is the page's outer HTML string, which presumably failed parsing or normalization rules.

Source

Thrown at pkg/engine/headless/crawler/state.go:113

func getStrippedDOM(contents string) (string, error) {
	normalized, err := domNormalizer.Apply(contents)
	if err != nil {
		return "", errors.Wrap(err, "could not normalize dom")
	}
	return normalized, nil
}

View on GitHub (pinned to e3e742739c)

Solutions

  1. Check the wrapped normalizer error for the specific parsing failure
  2. Validate/sanitize the HTML string before passing it to domNormalizer.Apply
  3. Return the original contents unnormalized as a degraded-mode fallback
  4. Report the failing page so the normalizer rules can be extended to cover it
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/engine/headless/crawler/state.go:113 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/50f158675bf06a23. Report an issue: GitHub.