{"record":{"id":"d562f55f3668c7fd","repo":"bee-san/RustScan","slug":"can-t-find-scripts-folder","errorCode":null,"errorMessage":"Can't find scripts folder {}","messagePattern":"Can't find scripts folder (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/scripts/mod.rs","lineNumber":333,"sourceCode":"        }\n        Err(error) => {\n            debug!(\"Command error {error}\",);\n            Err(anyhow!(error.to_string()))\n        }\n    }\n}\n\npub fn find_scripts(path: PathBuf) -> Result<Vec<PathBuf>> {\n    if path.is_dir() {\n        debug!(\"Scripts folder found {}\", &path.display());\n        let mut files_vec: Vec<PathBuf> = Vec::new();\n        for entry in fs::read_dir(path)? {\n            let entry = entry?;\n            files_vec.push(entry.path());\n        }\n        Ok(files_vec)\n    } else {\n        Err(anyhow!(\"Can't find scripts folder {}\", path.display()))\n    }\n}\n\n#[derive(Debug, Clone, Deserialize)]\npub struct ScriptFile {\n    pub path: Option<PathBuf>,\n    pub tags: Option<Vec<String>>,\n    pub developer: Option<Vec<String>>,\n    pub port: Option<String>,\n    pub ports_separator: Option<String>,\n    pub call_format: Option<String>,\n}\n\nimpl ScriptFile {\n    fn new(script: PathBuf) -> Option<ScriptFile> {\n        let real_path = script.clone();\n        let mut lines_buf = String::new();\n        if let Ok(file) = File::open(script) {","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/bee-san/RustScan/blob/e9dadb4a30dd0f3cc8b9b1c630a28ad351f8dbc3/src/scripts/mod.rs#L315-L351","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: ~/.rustscan_scripts.toml\ndirectory = \"scripts\"\n// after\ndirectory = \"/home/user/.rustscan_scripts\"","handlingStrategy":"validation","validationCode":"use std::path::Path;\n\nfn scripts_dir_ok(cfg: &ScriptConfig) -> bool {\n    match &cfg.directory {\n        Some(d) => Path::new(d).is_dir(),\n        None => dirs::home_dir()\n            .map(|h| h.join(\"rustscan_scripts\").is_dir())\n            .unwrap_or(false),\n    }\n}","typeGuard":"fn is_existing_dir(p: &Path) -> bool {\n    p.is_dir()\n}","tryCatchPattern":"match init_scripts() {\n    Ok(scripts) => use(scripts),\n    Err(e) if e.to_string().contains(\"Can't find scripts folder\") => {\n        eprintln!(\"{e}; create the folder or fix 'directory' in ~/.rustscan_scripts.toml\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["rust","scripts","filesystem","configuration"],"backgroundTag":"directory-not-found","analyzedSha":"e9dadb4a30dd0f3cc8b9b1c630a28ad351f8dbc3","analyzedAt":"2026-09-02T04:27:33.555Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}