{"record":{"id":"0371e1ba94ced76b","repo":"projectdiscovery/katana","slug":"could-not-create-new-page","errorCode":null,"errorMessage":"could not create new page","messagePattern":"could not create new page","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/headless/browser/browser.go","lineNumber":424,"sourceCode":"\t\t\ttempDir, err = os.MkdirTemp(\"\", \"katana-chrome-data-*\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"could not create temporary chrome data directory\")\n\t\t\t}\n\t\t\tshouldCleanupTempDir = true\n\t\t}\n\t}\n\n\tbrowser, err := l.launchBrowserWithDataDir(tempDir)\n\tif err != nil {\n\t\tif shouldCleanupTempDir {\n\t\t\t_ = os.RemoveAll(tempDir)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tpage, err := browser.Page(proto.TargetCreateTarget{})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not create new page\")\n\t}\n\n\tsuccessfulPageCreation := false\n\tdefer func() {\n\t\tif !successfulPageCreation {\n\t\t\t_ = page.Close()\n\t\t\tif l.opts.ChromeWSUrl == \"\" {\n\t\t\t\t_ = browser.Close()\n\t\t\t}\n\t\t\tif shouldCleanupTempDir {\n\t\t\t\t_ = os.RemoveAll(tempDir)\n\t\t\t}\n\t\t}\n\t}()\n\n\tpage = page.Sleeper(func() rodutils.Sleeper {\n\t\treturn backoffCountSleeper(100*time.Millisecond, 1*time.Second, 3, func(d time.Duration) time.Duration {\n\t\t\treturn d * 1","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/headless/browser/browser.go#L406-L442","documentation":"This error is wrapped by createBrowserPageFunc in katana's headless browser launcher when browser.Page(proto.TargetCreateTarget{}) fails. It means a new CDP target (tab/page) could not be created in the already-launched Chrome instance via the chromedp/rod DevTools protocol. The underlying error from rod (e.g. context deadline, browser crashed, connection lost) is preserved by errors.Wrap.","triggerScenarios":"Calling Launcher.GetPageFromPool() (or any code path using createBrowserPageFunc) when the Chrome process has crashed or exited, when the DevTools WebSocket connection has been dropped, when the browser was closed concurrently by another goroutine, or when CDP Target.createTarget times out against an overloaded/hung browser.","commonSituations":"Long-running crawls where Chrome was OOM-killed or crashed mid-run; running too many concurrent pages exhausting browser resources; Chrome version/protocol mismatch with the bundled rod protocol definitions; reusing a Launcher whose browser was already closed; sandboxed/containerized environments where Chrome dies shortly after launch.","solutions":["Check that the Chrome process is still alive and re-launch the browser (recreate the Launcher) when this error occurs, instead of reusing a stale browser instance.","Reduce concurrency (parallelism/page pool size) so Chrome is not overwhelmed and does not run out of memory or file descriptors.","Update the browser binaries / katana version so the CDP protocol matches the installed Chrome version.","Inspect the wrapped underlying error: if it is 'context deadline exceeded' the browser is hung — increase timeouts or restart it; if 'target closed' the browser crashed — check Chrome crash logs and resource limits (ulimit, cgroup memory)."],"exampleFix":"// before: reusing a possibly-dead browser from a cached launcher\npage, err := cachedLauncher.GetPageFromPool()\nif err != nil { return err } // \"could not create new page\" repeats forever\n\n// after: detect dead browser and relaunch\npage, err := cachedLauncher.GetPageFromPool()\nif err != nil {\n    _ = cachedLauncher.Close()\n    cachedLauncher, err = launcher.NewLauncher(opts...)\n    if err != nil { return err }\n    page, err = cachedLauncher.GetPageFromPool()\n}","handlingStrategy":"retry","validationCode":"// verify the browser is alive before requesting a page\nfunc browserAlive(l *launcher.Launcher) bool {\n    // e.g. attempt a cheap CDP call or track process state\n    return l != nil && l.BrowserHealthy()\n}","typeGuard":null,"tryCatchPattern":"page, err := l.GetPageFromPool()\nif err != nil {\n    if strings.Contains(err.Error(), \"could not create new page\") {\n        // relaunch browser and retry once\n        _ = l.Close()\n        l, err = launcher.NewLauncher(opts...)\n        if err == nil { page, err = l.GetPageFromPool() }\n    }\n    if err != nil { return err }\n}","preventionTips":["Bound page-pool size to what the host's memory can sustain for Chrome.","Monitor Chrome process liveness and restart the launcher proactively.","Keep Chrome and katana/rod versions matched.","Check ulimit/cgroup limits (files, memory) in containers before long crawls."],"tags":["headless-browser","chrome","cdp","rod"],"backgroundTag":"cdp-target-creation-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"}