{"record":{"id":"f97830b962aadb0e","repo":"projectdiscovery/katana","slug":"errmaxdepthreached","errorCode":"ErrMaxDepthReached","errorMessage":"max depth reached","messagePattern":"max depth reached","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/engine/common/error.go","lineNumber":6,"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":"ErrMaxDepthReached is a sentinel error returned when a request's Depth exceeds Options.MaxDepth. The URL is output with this error (so users can see why it was skipped) and is not enqueued for crawling. It is a normal termination condition of depth-limited crawling, not a bug.","triggerScenarios":"In Enqueue (pkg/engine/common/base.go:132) when nr.Depth > s.Options.Options.MaxDepth; typically links found on pages already at MaxDepth that would push traversal one level deeper.","commonSituations":"Running katana with the default -d/--depth limit (e.g. depth 3) on deep sites and wondering why deep URLs appear in output with 'max depth reached'; forgetting to raise --depth when full coverage is needed.","solutions":["Increase MaxDepth (katana -depth 10) if deeper crawling is required","Filter results whose Error equals common.ErrMaxDepthReached.Error() if only successfully visited URLs matter","Accept the behavior: URLs skipped by depth may still be visited later via a shorter path, by design"],"exampleFix":"// before: default shallow crawl missing deep pages\nopts.MaxDepth = 3\n// after\nopts.MaxDepth = 10 // raise depth for deep sites","handlingStrategy":"validation","validationCode":"u, err := url.Parse(targetURL)\nif err != nil { return err }\nif expectedDepth(u) > opts.MaxDepth {\n    opts.MaxDepth = expectedDepth(u) // raise before enqueue\n}","typeGuard":"func isDepthSkipped(result *output.Result) bool {\n    return result != nil && result.Error == common.ErrMaxDepthReached.Error()\n}","tryCatchPattern":"if result.Error == common.ErrMaxDepthReached.Error() {\n    log.Debugf(\"skipped (depth): %s\", result.Request.URL)\n    return nil\n}","preventionTips":["Set -depth explicitly for deep sites instead of relying on defaults","Remember out-of-depth URLs still appear in output — filter by the error string","Design link-graph expectations before choosing MaxDepth"],"tags":["crawler","depth-limit","sentinel-error"],"backgroundTag":"max-depth-reached","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"}