{"record":{"id":"bc1a8a8212f9b854","repo":"epi052/feroxbuster","slug":"could-not-get-underlying-feroxscans","errorCode":null,"errorMessage":"Could not get underlying FeroxScans","messagePattern":"Could not get underlying FeroxScans","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/event_handlers/container.rs","lineNumber":181,"sourceCode":"        let methods = self.config.methods.len().max(1);\n        let base_requests = 1; // the bare word (with optional slash)\n        let static_extensions = self.config.extensions.len();\n        let dynamic_extensions = self.num_collected_extensions();\n\n        let total_paths = base_requests + static_extensions + dynamic_extensions;\n\n        total_paths * methods\n    }\n\n    /// Helper to easily get the (locked) underlying FeroxScans object\n    pub fn ferox_scans(&self) -> Result<Arc<FeroxScans>> {\n        if let Ok(guard) = self.scans.read().as_ref() {\n            if let Some(handle) = guard.as_ref() {\n                return Ok(handle.data.clone());\n            }\n        }\n\n        bail!(\"Could not get underlying FeroxScans\")\n    }\n}\n","sourceCodeStart":163,"sourceCodeEnd":184,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/event_handlers/container.rs#L163-L184","documentation":"ferox_scans returns this error when the FeroxScans handle behind the container's RwLock cannot be read or is None. Callers use this to get scan data (e.g. collected_extensions); without the handle, scan bookkeeping is unavailable.","triggerScenarios":"Calling ferox_scans when self.scans holds None (container created without FeroxScans initialized) or the RwLock read fails due to poisoning after a panic elsewhere.","commonSituations":"Accessing scan metadata before the scan handler initialized FeroxScans; use in tests with a manually-built container; a poisoned lock after a panic in a scan task.","solutions":["Initialize FeroxScans on the container before querying it","Recover or replace a poisoned lock (check for an earlier panic that poisoned scans)","Call ferox_scans only after the scan event loop has started","In tests, use the standard container constructor instead of a partial default"],"exampleFix":"// before\nlet scans = container.ferox_scans()?; // before init\n// after\ncontainer.initialize()?;\nlet scans = container.ferox_scans()?;","handlingStrategy":"try-catch","validationCode":"if container.scans_initialized() {\n    let scans = container.ferox_scans()?;\n}","typeGuard":null,"tryCatchPattern":"let scans = match container.ferox_scans() {\n    Ok(s) => s,\n    Err(e) if e.to_string().contains(\"Could not get underlying FeroxScans\") => {\n        log::warn!(\"FeroxScans not initialized yet\");\n        return Ok(());\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Initialize FeroxScans before querying scan metadata","Avoid accessing scan state from threads that may panic (poisons the lock)","Query scan data only while the scan event loop is running"],"tags":["concurrency","internal-state"],"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"}