{"record":{"id":"58ef666be09667da","repo":"epi052/feroxbuster","slug":"couldn-t-load-config","errorCode":null,"errorMessage":"Couldn't load config","messagePattern":"Couldn't load config","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/config/container.rs","lineNumber":653,"sourceCode":"        // in the Configuration struct so that we don't change anything that isn't\n        // actually specified in the config file\n        //\n        // search for a config using the following order of precedence\n        //   - /etc/feroxbuster/\n        //   - CONFIG_DIR/ferxobuster/\n        //   - same directory as feroxbuster executable\n        //   - current directory\n\n        // merge a config found at /etc/feroxbuster/ferox-config.toml\n        let config_file = Path::new(\"/etc/feroxbuster\").join(DEFAULT_CONFIG_NAME);\n        Self::parse_and_merge_config(config_file, config)?;\n\n        // merge a config found at ~/.config/feroxbuster/ferox-config.toml\n        // config_dir() resolves to one of the following\n        //   - linux: $XDG_CONFIG_HOME or $HOME/.config\n        //   - macOS: $HOME/Library/Application Support\n        //   - windows: {FOLDERID_RoamingAppData}\n        let config_dir = dirs::config_dir().ok_or_else(|| anyhow!(\"Couldn't load config\"))?;\n        let config_file = config_dir.join(\"feroxbuster\").join(DEFAULT_CONFIG_NAME);\n        Self::parse_and_merge_config(config_file, config)?;\n\n        // merge a config found in same the directory as feroxbuster executable\n        let exe_path = current_exe()?;\n        let bin_dir = exe_path\n            .parent()\n            .ok_or_else(|| anyhow!(\"Couldn't load config\"))?;\n        let config_file = bin_dir.join(DEFAULT_CONFIG_NAME);\n        Self::parse_and_merge_config(config_file, config)?;\n\n        // merge a config found in the user's current working directory\n        let cwd = current_dir()?;\n        let config_file = cwd.join(DEFAULT_CONFIG_NAME);\n        Self::parse_and_merge_config(config_file, config)?;\n\n        Ok(())\n    }","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/config/container.rs#L635-L671","documentation":"parse_config_files needs the user's OS config directory (via the dirs crate) to locate ~/.config/feroxbuster/ferox-config.toml. If dirs::config_dir() returns None — meaning HOME/XDG or the platform equivalent cannot be resolved — the function bails with this error rather than silently skipping default config discovery.","triggerScenarios":"Calling Configuration::parse_config_files (directly or via startup) in an environment where dirs::config_dir() yields None: HOME unset on Linux, or no roaming-app-data directory resolvable on Windows/macOS.","commonSituations":"Running feroxbuster in a container or CI job with no HOME set, running under a service account with no profile, or a stripped sandbox environment.","solutions":["Set the HOME environment variable (Linux/macOS) or ensure the user profile exists before running","Set XDG_CONFIG_HOME to an existing writable directory as an alternative","Report this as a bug if the environment has a valid HOME yet the error persists"],"exampleFix":"// before (shell)\nferoxbuster -u http://host # container with HOME unset\n// after (shell)\nHOME=/root feroxbuster -u http://host","handlingStrategy":"fallback","validationCode":"let home_ok = std::env::var_os(\"HOME\").is_some() || std::env::var_os(\"XDG_CONFIG_HOME\").is_some();\nif !home_ok { eprintln!(\"set HOME or XDG_CONFIG_HOME\"); }","typeGuard":"fn config_dir_available() -> bool { dirs::config_dir().is_some() }","tryCatchPattern":"match config.parse_config_files() { Err(e) if e.to_string().contains(\"Couldn't load config\") => eprintln!(\"no config dir resolvable; set HOME/XDG_CONFIG_HOME\"), Err(e) => return Err(e), Ok(_) => {} }","preventionTips":["Ensure HOME is set in containers/CI before launching","Set XDG_CONFIG_HOME to a writable directory when HOME is unavailable","Prefer --config to point explicitly at a config file in stripped environments"],"tags":["config","environment","directories"],"backgroundTag":"missing-env-var","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"}