{"record":{"id":"75217d1f8720dd2c","repo":"projectdiscovery/katana","slug":"erroutofscope","errorCode":"ErrOutOfScope","errorMessage":"out of scope","messagePattern":"out of scope","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/engine/common/error.go","lineNumber":5,"sourceCode":"package common\n\nimport \"errors\"\n\nvar ErrOutOfScope = errors.New(\"out of scope\")\nvar ErrMaxDepthReached = errors.New(\"max depth reached\")\n","sourceCodeStart":1,"sourceCodeEnd":7,"githubUrl":"https://github.com/projectdiscovery/katana/blob/e3e742739c3746f085943ce918fb4e2b8daf6fe6/pkg/engine/common/error.go#L1-L7","documentation":"ErrOutOfScope is a sentinel error in katana's common engine package indicating a request was not visited because its URL falls outside the configured crawl scope. Instead of being enqueued, out-of-scope requests are sent directly to output with this error attached. It signals intentional filtering, not a runtime failure.","triggerScenarios":"Enqueue receives a request whose URL does not match the scope rules (-d domain, scope filters, field-scope); with Options.DisplayOutScope set, the request is passed to s.Output(nr, nil, ErrOutOfScope) at pkg/engine/common/base.go:160 and skipped from the queue.","commonSituations":"Crawling with -d example.com and encountering links to cdn.example.org or third-party sites; using a custom scope filter that is stricter than expected; enabling display-out-scope and mistaking these output entries for crawl errors.","solutions":["Verify the URL is genuinely out of scope; if it should be crawled, widen scope with -d / -c / scope filters or use 'in-scope' regex options","Set Options.Options.DisplayOutScope only when diagnostics on skipped URLs are desired","Compare the error against common.ErrOutOfScope (errors.Is) to filter it from real failures in custom output writers"],"exampleFix":"// before: treating every writer error as fatal\nif result.Error != \"\" { return fmt.Errorf(\"crawl failed: %s\", result.Error) }\n// after\nif errors.Is(err, common.ErrOutOfScope) { return nil } // expected scope filtering","handlingStrategy":"type-guard","validationCode":"u, err := url.Parse(targetURL)\nif err != nil { return err }\nif !scopeMatcher.Match(u) { // pre-check against scope regexes\n    return nil // skip before Enqueue\n}","typeGuard":"func isOutOfScope(err error) bool { return errors.Is(err, common.ErrOutOfScope) }","tryCatchPattern":"if result.Error != \"\" {\n    if errors.Is(err, common.ErrOutOfScope) {\n        return nil // expected, ignore\n    }\n    return err\n}","preventionTips":["Align scope flags (-d, scope filters) with the domains you expect to crawl","Use --display-out-scope only for diagnostics","Always compare with errors.Is/== against the sentinel, never string-match generic errors"],"tags":["crawler","scope-filtering","sentinel-error"],"backgroundTag":"url-out-of-scope","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"}