{"record":{"id":"db3c25f1779044ff","repo":"epi052/feroxbuster","slug":"could-not-find-feroxscan-associated-with-this-shouldn-t","errorCode":null,"errorMessage":"Could not find FeroxScan associated with {}; this shouldn't happen... exiting","messagePattern":"Could not find FeroxScan associated with (.+?); this shouldn't happen\\.\\.\\. exiting","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/scanner/ferox_scanner.rs","lineNumber":246,"sourceCode":"            let mut extractor = ExtractorBuilder::default()\n                .target(ExtractionTarget::RobotsTxt)\n                .url(&self.target_url)\n                .handles(self.handles.clone())\n                .build()?;\n            if let Ok(result) = extractor.extract().await {\n                extraction_tasks.push(extractor.request_links(result).await?)\n            }\n        }\n\n        let scanned_urls = self.handles.ferox_scans()?;\n        let ferox_scan = match scanned_urls.get_scan_by_url(&self.target_url) {\n            Some(scan) => scan,\n            None => {\n                let msg = format!(\n                    \"Could not find FeroxScan associated with {}; this shouldn't happen... exiting\",\n                    self.target_url\n                );\n                bail!(fmt_err(&msg))\n            }\n        };\n\n        let progress_bar = ferox_scan.progress_bar();\n\n        // When acquire is called and the semaphore has remaining permits, the function immediately\n        // returns a permit. However, if no remaining permits are available, acquire (asynchronously)\n        // waits until an outstanding permit is dropped, at which point, the freed permit is assigned\n        // to the caller.\n        ferox_scan.set_status(ScanStatus::Waiting)?;\n        let _permit = self.scan_limiter.acquire().await;\n        ferox_scan.set_status(ScanStatus::Running)?;\n        ferox_scan.set_start_time(Instant::now())?;\n\n        if self.handles.config.scan_limit > 0 {\n            scan_timer = Instant::now();\n            progress_bar.reset();\n        }","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/scanner/ferox_scanner.rs#L228-L264","documentation":"FeroxScanner::scan_url looks up the FeroxScan record tracked for self.target_url in the central scan collection before starting work. If the record is missing - which the code comments say should never happen because scan_url is only called after the FeroxScan was inserted - it bails with this message and exits, since proceeding without the tracked scan would break progress reporting and limits.","triggerScenarios":"scan_url is invoked (via ordered_scan_url or get_scan_by_url) for a URL whose FeroxScan was never inserted into, or was removed from, the SCANS collection.","commonSituations":"Race conditions where a scan entry is dropped between insertion and lookup, programmatically calling scan APIs for a URL never registered, or internal bugs during scan lifecycle management.","solutions":["Re-run the scan; this is usually a transient/race condition","Ensure scan URLs originate from normal feroxbuster flow (not manual injection into the scan map)","Capture with RUST_BACKTRACE=1 and -vv logging and report upstream if reproducible"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// This is an internal invariant breach; treat as fatal, retry the whole scan\nmatch scanner.scan_url(&url, &handles).await {\n    Err(e) if e.to_string().contains(\"this shouldn't happen\") => {\n        log::error!(\"invariant violation: {e}; restarting scan\");\n    }\n    Err(e) => log::warn!(\"scan error: {e}\"),\n    Ok(_) => {}\n}","preventionTips":["Avoid manually injecting/removing entries in the scan collection","Retry the scan - usually transient","Report with logs if reproducible"],"tags":["internal","invariant","scanner"],"backgroundTag":"internal-invariant-violation","analyzedSha":"1f595dab5c76858d5a14fbc47dabf2563d729c62","analyzedAt":"2026-09-13T19:33:06.208Z","contentChangedAt":"2026-09-13T19:33:06.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}