{"record":{"id":"43e407d9480b703b","repo":"projectdiscovery/katana","slug":"failed-to-create-text-normalizer","errorCode":null,"errorMessage":"failed to create text normalizer","messagePattern":"failed to create text normalizer","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/engine/headless/crawler/normalizer/normalizer.go","lineNumber":27,"sourceCode":"\t\"strings\"\n\n\t\"github.com/PuerkitoBio/goquery\"\n\t\"github.com/pkg/errors\"\n\thtmlpkg \"golang.org/x/net/html\"\n)\n\nvar whiteSpacesRegex = regexp.MustCompile(`[\\r\\n]+|\\s+`)\n\ntype Normalizer struct {\n\tdom  *DOMNormalizer\n\ttext *TextNormalizer\n}\n\n// New returns a new Normalizer\nfunc New() (*Normalizer, error) {\n\ttextNormalizer, err := NewTextNormalizer()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create text normalizer\")\n\t}\n\tdomNormalizer := NewDOMNormalizer()\n\treturn &Normalizer{\n\t\tdom:  domNormalizer,\n\t\ttext: textNormalizer,\n\t}, nil\n}\n\n// Apply applies the normalizers to the given content\n//\n// It normalizes the given content by:\n// - Applying the DOM normalizer\n// - Applying the text normalizer\n// - Denormalizing it\nfunc (n *Normalizer) Apply(text string) (string, error) {\n\tfirst := normalizeDocument(text)\n\n\tfirstpass, err := n.dom.Apply(first)","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/crawler/normalizer/normalizer.go#L9-L45","documentation":"Error from normalizer.New(): NewTextNormalizer() returned an error while constructing the text normalization pipeline, wrapped here as \"failed to create text normalizer\". This is the root cause surfaced by the crawler package's \"failed to create domnormalizer\" init error, and it prevents any Normalizer (and thus any headless Crawler) from being created.","triggerScenarios":"1) NewTextNormalizer fails to load its backing data (missing embedded/disk resources, unreadable file). 2) Corrupted or incomplete installation where expected assets are absent. 3) Environment/permission issues preventing the resource load.","commonSituations":"Trimmed container images; broken katana builds; running the binary from a directory without access to data files; version upgrades that moved assets.","solutions":["Reinstall katana so normalizer resources exist and are readable","Inspect the wrapped error (print with %+v) to identify the exact missing resource","Fix file permissions or working directory if assets load from disk","Rebuild from source ensuring embedded assets are included"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check the text normalizer can be constructed before use\nif _, err := normalizer.New(); err != nil {\n    log.Fatalf(\"normalizer unavailable: %+v\", err)\n}","typeGuard":"func normalizerReady(n *normalizer.Normalizer) bool { return n != nil }","tryCatchPattern":"norm, err := normalizer.New()\nif err != nil {\n    log.Fatalf(\"text normalizer init failed: %+v\", err)\n}","preventionTips":["Ensure embedded/disk assets exist and are readable","Check file permissions for the running user","Rebuild with go:embed resources included","Surface wrapped causes with %+v in logs"],"tags":["initialization","text-normalizer","katana"],"backgroundTag":"normalizer-init-failed","analyzedSha":"e3e742739c3746f085943ce918fb4e2b8daf6fe6","analyzedAt":"2026-09-03T14:55:13.248Z","contentChangedAt":"2026-09-03T14:55:13.248Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}