{"record":{"id":"64f48ca8dd063b3f","repo":"bee-san/RustScan","slug":"failed-to-parse-execution-format","errorCode":null,"errorMessage":"Failed to parse execution format.","messagePattern":"Failed to parse execution format\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/scripts/mod.rs","lineNumber":245,"sourceCode":"        debug!(\"run self {:?}\", &self);\n\n        let separator = self.ports_separator.unwrap_or_else(|| \",\".into());\n\n        let mut ports_str = self\n            .open_ports\n            .iter()\n            .map(ToString::to_string)\n            .collect::<Vec<String>>()\n            .join(&separator);\n        if let Some(port) = self.trigger_port {\n            ports_str = port;\n        }\n\n        let mut final_call_format = String::new();\n        if let Some(call_format) = self.call_format {\n            final_call_format = call_format;\n        } else {\n            return Err(anyhow!(\"Failed to parse execution format.\"));\n        }\n        let default_template: Template = Template::new(&final_call_format);\n        let mut to_run = String::new();\n\n        if final_call_format.contains(\"{{script}}\") {\n            let exec_parts_script: ExecPartsScript = ExecPartsScript {\n                script: self.path.unwrap().to_str().unwrap().to_string(),\n                ip: self.ip.to_string(),\n                port: ports_str,\n                ipversion: match &self.ip {\n                    IpAddr::V4(_) => String::from(\"4\"),\n                    IpAddr::V6(_) => String::from(\"6\"),\n                },\n            };\n            to_run = default_template.fill_with_struct(&exec_parts_script)?;\n        } else {\n            let exec_parts: ExecParts = ExecParts {\n                ip: self.ip.to_string(),","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/bee-san/RustScan/blob/e9dadb4a30dd0f3cc8b9b1c630a28ad351f8dbc3/src/scripts/mod.rs#L227-L263","documentation":"ScriptFile::run builds the command from a call_format template. If the script ends up with no call_format (neither script-specific nor a default template applied), run returns the anyhow error 'Failed to parse execution format.' — i.e. there is no template string telling it how to execute the script.","triggerScenarios":"Calling run() on a parsed ScriptFile whose resolved call_format is None: the script's .rustscan_scripts.toml descriptor lacks a 'call_format' and no default call format was configured/applied for that script type.","commonSituations":"Custom scripts placed in the scripts directory whose descriptor file omits call_format; typos in the TOML key (e.g. 'callformat'); using an interpreter script type that has no built-in default template; older config formats after a rustscan upgrade.","solutions":["Add 'call_format' to the script's entry in ~/.rustscan_scripts.toml, e.g. call_format = \"bash {{script}} {{file}}\"","Rely on built-in defaults by naming the script with a recognized extension (.sh, .py, .pl) so a default template is chosen","Check for typos: the key must be exactly call_format","Update rustscan if your config format predates the current call_format scheme"],"exampleFix":"// before: ~/.rustscan_scripts.toml\n[my_script]\npath = \"/scripts/scan.sh\"\n// after\n[my_script]\npath = \"/scripts/scan.sh\"\ncall_format = \"bash {{script}} {{file}}\"","handlingStrategy":"validation","validationCode":"// Validate every script entry in ~/.rustscan_scripts.toml has call_format\nfn validate_call_formats(config: &toml::Value) -> Result<(), String> {\n    for (name, entry) in config.as_table().ok_or(\"config not a table\")? {\n        if entry.get(\"call_format\").and_then(|v| v.as_str()).is_none() {\n            return Err(format!(\"script '{}' is missing call_format\", name));\n        }\n    }\n    Ok(())\n}","typeGuard":"fn has_call_format(script: &ScriptFile) -> bool {\n    script.call_format.as_deref().map(|s| !s.is_empty()).unwrap_or(false)\n}","tryCatchPattern":"match script.run() {\n    Ok(output) => println!(\"{output}\"),\n    Err(e) if e.to_string().contains(\"Failed to parse execution format\") => {\n        eprintln!(\"Add call_format = \\\"bash {{{{script}}}} {{{{file}}}}\\\" to the script's TOML entry\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Every custom script descriptor must define call_format (or use a standard .sh/.py/.pl extension with defaults)","Check the exact key spelling: call_format with an underscore","After rustscan upgrades, re-validate old config files against the current format","Test each script with rustscan's debug logging before bulk use"],"tags":["rust","scripts","configuration","template"],"backgroundTag":"missing-call-format-template","analyzedSha":"e9dadb4a30dd0f3cc8b9b1c630a28ad351f8dbc3","analyzedAt":"2026-09-02T04:27:33.555Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}