{"record":{"id":"d08c3dfa11b6d552","repo":"nikivdev/code","slug":"has-no-exec-run-program-in","errorCode":null,"errorMessage":"{} has no exec.run program in {}","messagePattern":"(.+?) has no exec\\.run program in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/external_cli.rs","lineNumber":213,"sourceCode":"}\n\nimpl ResolvedExternalCliTool {\n    pub fn command<I, S>(&self, args: I) -> Result<Command>\n    where\n        I: IntoIterator<Item = S>,\n        S: AsRef<str>,\n    {\n        if self.manifest.exec.run.is_empty() {\n            bail!(\n                \"{} has no exec.run argv in {}\",\n                self.manifest.id,\n                self.manifest_path.display()\n            );\n        }\n\n        let mut argv = self.manifest.exec.run.iter();\n        let Some(program) = argv.next() else {\n            bail!(\n                \"{} has no exec.run program in {}\",\n                self.manifest.id,\n                self.manifest_path.display()\n            );\n        };\n\n        let mut command = Command::new(program);\n        command.current_dir(&self.source_root);\n        command.args(argv);\n        for arg in args {\n            command.arg(arg.as_ref());\n        }\n\n        if let Some(env_map) = &self.manifest.exec.env {\n            command.envs(env_map);\n        }\n\n        Ok(command)","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/external_cli.rs#L195-L231","documentation":"Thrown by `Commander::command` after the `exec.run` argv list is confirmed non-empty, but `argv.next()` still returns `None`. This is a defensive check ensuring the first argv element (the program to execute) exists before spawning. It reports the manifest id and manifest path.","triggerScenarios":"Calling `command(...)` when `manifest.exec.run` is non-empty per a prior check but its iterator yields no first element — practically unreachable unless `exec.run` was mutated concurrently between the two checks, or the code path changed so the empty check was bypassed.","commonSituations":"Rarely seen in practice; would indicate a logic bug in the library or concurrent mutation of the manifest struct after validation.","solutions":["Confirm the manifest's `exec.run` contains a program name as its first element (e.g. `run = [\"my-cli\"]`, not `run = [[\"--flag\"]]`).","If reproducible, file a bug: the preceding `exec.run.is_empty()` check should have caught an empty argv.","Re-read/re-parse the manifest to rule out in-memory mutation between validation and use."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn ensure_program_present(manifest: &ExternalCliManifest) -> Result<(), String> {\n    match manifest.exec.run.first() {\n        Some(p) if !p.is_empty() => Ok(()),\n        _ => Err(format!(\"manifest {} exec.run needs a program\", manifest.id)),\n    }\n}","typeGuard":"fn has_program(manifest: &ExternalCliManifest) -> bool {\n    manifest.exec.run.first().map_or(false, |p| !p.is_empty())\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"no exec.run program\") => {\n        eprintln!(\"defensive branch hit — re-parse manifest and retry once\");\n        // re-read manifest and retry\n        retry_with_fresh_manifest()\n    }\n    other => other,\n}","preventionTips":["Put the program name as the first element of `exec.run`.","Never mutate a parsed manifest struct after validation passes.","Re-read the manifest from disk rather than reusing a long-lived in-memory copy.","Treat this error as a library bug if reproducible and report it."],"tags":["manifest","external-cli","defensive-check"],"backgroundTag":"invalid-manifest-argv","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}