bee-san/RustScan · error
Can't find scripts folder {}
Error message
Can't find scripts folder {} What it means
find_scripts enumerates files in the resolved script directory. If that path does not exist (or is not a directory), it returns the anyhow error 'Can't find scripts folder <path>'. The offending path is included in the message to help locate the misconfiguration.
Source
Thrown at src/scripts/mod.rs:333
}
Err(error) => {
debug!("Command error {error}",);
Err(anyhow!(error.to_string()))
}
}
}
pub fn find_scripts(path: PathBuf) -> Result<Vec<PathBuf>> {
if path.is_dir() {
debug!("Scripts folder found {}", &path.display());
let mut files_vec: Vec<PathBuf> = Vec::new();
for entry in fs::read_dir(path)? {
let entry = entry?;
files_vec.push(entry.path());
}
Ok(files_vec)
} else {
Err(anyhow!("Can't find scripts folder {}", path.display()))
}
}
#[derive(Debug, Clone, Deserialize)]
pub struct ScriptFile {
pub path: Option<PathBuf>,
pub tags: Option<Vec<String>>,
pub developer: Option<Vec<String>>,
pub port: Option<String>,
pub ports_separator: Option<String>,
pub call_format: Option<String>,
}
impl ScriptFile {
fn new(script: PathBuf) -> Option<ScriptFile> {
let real_path = script.clone();
let mut lines_buf = String::new();
if let Ok(file) = File::open(script) {View on GitHub (pinned to e9dadb4a30)
Solutions
- Create the expected directory (mkdir -p ~/.rustscan_scripts) or the configured 'directory' path
- Fix the 'directory' value in ~/.rustscan_scripts.toml to an absolute, existing path
- Use an absolute path instead of a relative one to avoid cwd surprises
- Check the path printed in the error message — it shows exactly what rustscan looked for
Example fix
// before: ~/.rustscan_scripts.toml directory = "scripts" // after directory = "/home/user/.rustscan_scripts"
Defensive patterns
Strategy: validation
Validate before calling
use std::path::Path;
fn scripts_dir_ok(cfg: &ScriptConfig) -> bool {
match &cfg.directory {
Some(d) => Path::new(d).is_dir(),
None => dirs::home_dir()
.map(|h| h.join("rustscan_scripts").is_dir())
.unwrap_or(false),
}
} Type guard
fn is_existing_dir(p: &Path) -> bool {
p.is_dir()
} Try / catch
match init_scripts() {
Ok(scripts) => use(scripts),
Err(e) if e.to_string().contains("Can't find scripts folder") => {
eprintln!("{e}; create the folder or fix 'directory' in ~/.rustscan_scripts.toml");
}
Err(e) => return Err(e),
} Prevention
- Run mkdir -p ~/.rustscan_scripts (or your configured dir) after installing rustscan
- Always use absolute paths for the 'directory' config value
- Verify the printed path in the error matches what you expect
- Re-check the path after copying configs between machines or users
When it happens
Trigger: The directory set via 'directory' in ScriptConfig does not exist; the fallback ~/rustscan_scripts directory was never created; a typo in the configured path; the directory was removed after config was written.
Common situations: Fresh rustscan installs where users enabled scripts but never ran the script setup step to create ~/.rustscan_scripts; pointing 'directory' at a relative path resolved from an unexpected cwd; config copied from another machine with a different user's paths.
Related errors
- Failed to parse execution format.
- Could not infer scripts path.
- Unknown exit status
- Exit code = {}
- Could not infer ScriptConfig path.
AI-assisted analysis of bee-san/RustScan@e9dadb4a30 (2026-09-02).
Data as JSON: /api/errors/d562f55f3668c7fd.
Report an issue: GitHub.