{"record":{"id":"be12b052e9ffab2b","repo":"projectdiscovery/katana","slug":"errnonavigationpossible","errorCode":"ErrNoNavigationPossible","errorMessage":"no navigation possible","messagePattern":"no navigation possible","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/engine/headless/crawler/state.go","lineNumber":118,"sourceCode":"\treturn state, nil\n}\n\nfunc sha256Hash(item string) string {\n\thasher := sha256.New()\n\thasher.Write([]byte(item))\n\thashItem := hex.EncodeToString(hasher.Sum(nil))\n\treturn hashItem\n}\n\nfunc getStrippedDOM(contents string) (string, error) {\n\tnormalized, err := domNormalizer.Apply(contents)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"could not normalize dom\")\n\t}\n\treturn normalized, nil\n}\n\nvar ErrNoNavigationPossible = errors.New(\"no navigation possible\")\n\n// navigateBackToStateOrigin implements the logic to navigate back to the state origin\n//\n// It implements different logics as an optimization to decide\n// how to navigate back.\n//\n//  1. If the action has an element, check if the element is visible on the current page\n//     If the element is visible, directly use that to navigate.\n//\n//  2. If we have browser history, and the page is in the history which was the origin\n//     of the action, then we can directly use the browser history to navigate back.\n//\n// 3. If all else fails, we have the shortest path navigation.\nfunc (c *Crawler) navigateBackToStateOrigin(action *types.Action, page *browser.BrowserPage, currentPageHash string) (string, error) {\n\tc.logger.Debug(\"Found action with different origin id\",\n\t\tslog.String(\"action_origin_id\", action.OriginID),\n\t\tslog.String(\"current_page_hash\", currentPageHash),\n\t)","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/crawler/state.go#L100-L136","documentation":"ErrNoNavigationPossible is returned by navigateBackToStateOrigin when the crawler cannot restore the browser back to a previous state's origin page hash (newPageHash == \"\"). Crawl's loop catches it, logs at debug level, counts a consecutive failure and skips the action, so a crawl continues but that branch of exploration is abandoned.","triggerScenarios":"After executing an action, the crawler tries to navigate back to the state origin (history back, re-navigation heuristics) and every strategy yields an empty page hash (state.go:171) — e.g. the action opened a new tab, destroyed history, or landed on about:blank.","commonSituations":"Actions that spawn popups or replace the document such that 'back' is impossible; sites that rewrite history (pushState loops); sessions expiring mid-crawl so replaying navigation fails.","solutions":["Treat as skippable — the crawler already increments consecutiveFailures and moves on","Reduce actions that open new windows (browser popup blocking options)","Increase per-page wait/retry so navigation-back strategies have time to succeed","Check debug logs (logger.Debug) to identify which actions cause it"],"exampleFix":"// before: aborting crawl on this error\nif err := c.Crawl(ctx); err != nil { log.Fatal(err) }\n// after\nif err := c.Crawl(ctx); err != nil && !errors.Is(err, crawler.ErrNoNavigationPossible) { log.Fatal(err) }","handlingStrategy":"try-catch","validationCode":"// ensure history is navigable before relying on back-navigation:\nif len(page.History()) < 2 { skip back-navigation strategy }","typeGuard":"func isNoNavigationPossible(err error) bool { return errors.Is(err, crawler.ErrNoNavigationPossible) }","tryCatchPattern":"if errors.Is(err, crawler.ErrNoNavigationPossible) {\n    log.Debug(\"skipping action: no navigation possible\")\n    consecutiveFailures++\n    continue\n}","preventionTips":["Block popups/new windows so actions don't orphan the current state","Increase waits so navigation-back heuristics can succeed","Keep sessions alive (cookies/tokens) to avoid failed replays","Enable debug logging to find offending actions"],"tags":["headless-browser","navigation","state-restore"],"backgroundTag":"navigation-restore-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"}