nikivdev/code · error

{} has no exec.run program in {}

Error message

{} has no exec.run program in {}

What it means

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.

Source

Thrown at src/external_cli.rs:213

}

impl ResolvedExternalCliTool {
    pub fn command<I, S>(&self, args: I) -> Result<Command>
    where
        I: IntoIterator<Item = S>,
        S: AsRef<str>,
    {
        if self.manifest.exec.run.is_empty() {
            bail!(
                "{} has no exec.run argv in {}",
                self.manifest.id,
                self.manifest_path.display()
            );
        }

        let mut argv = self.manifest.exec.run.iter();
        let Some(program) = argv.next() else {
            bail!(
                "{} has no exec.run program in {}",
                self.manifest.id,
                self.manifest_path.display()
            );
        };

        let mut command = Command::new(program);
        command.current_dir(&self.source_root);
        command.args(argv);
        for arg in args {
            command.arg(arg.as_ref());
        }

        if let Some(env_map) = &self.manifest.exec.env {
            command.envs(env_map);
        }

        Ok(command)

View on GitHub (pinned to a747e741ae)

Solutions

  1. Confirm the manifest's `exec.run` contains a program name as its first element (e.g. `run = ["my-cli"]`, not `run = [["--flag"]]`).
  2. If reproducible, file a bug: the preceding `exec.run.is_empty()` check should have caught an empty argv.
  3. Re-read/re-parse the manifest to rule out in-memory mutation between validation and use.
Defensive patterns

Strategy: try-catch

Validate before calling

fn ensure_program_present(manifest: &ExternalCliManifest) -> Result<(), String> {
    match manifest.exec.run.first() {
        Some(p) if !p.is_empty() => Ok(()),
        _ => Err(format!("manifest {} exec.run needs a program", manifest.id)),
    }
}

Type guard

fn has_program(manifest: &ExternalCliManifest) -> bool {
    manifest.exec.run.first().map_or(false, |p| !p.is_empty())
}

Try / catch

match result {
    Err(e) if e.to_string().contains("no exec.run program") => {
        eprintln!("defensive branch hit — re-parse manifest and retry once");
        // re-read manifest and retry
        retry_with_fresh_manifest()
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: Rarely seen in practice; would indicate a logic bug in the library or concurrent mutation of the manifest struct after validation.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/d08c3dfa11b6d552. Report an issue: GitHub.