vectordotdev/vector · error

Vector build completed but the binary was not found at

Error message

Vector build completed but the binary was not found at {}

What it means

After a successful `cargo build --bin vector`, `vdev` expects the debug binary at `<target_dir>/debug/vector[.exe]`. If the file does not exist despite the build reporting success, the check bails with the expected path included.

Solutions

  1. Verify the binary exists at the path printed in the error.
  2. Check `CARGO_TARGET_DIR` in the environment and `.cargo/config.toml` for overridden target directories.
  3. Re-run the build with `cargo build --bin vector` and inspect where the output lands.
Defensive patterns

Strategy: type-guard

Validate before calling

let bin = std::env::var_os("CARGO_TARGET_DIR").map(PathBuf::from).unwrap_or_else(|| PathBuf::from("target")).join("debug").join(format!("vector{}", std::env::consts::EXE_SUFFIX));
assert!(bin.is_file(), "binary missing at {bin:?}");

Type guard

fn vector_binary_present() -> bool {
    let dir = std::env::var_os("CARGO_TARGET_DIR").map(PathBuf::from).unwrap_or_else(|| PathBuf::from("target"));
    dir.join("debug").join(format!("vector{}", std::env::consts::EXE_SUFFIX)).is_file()
}

Prevention

When it happens

Trigger: `CARGO_TARGET_DIR` points somewhere unexpected, a previous clean removed the binary, or a build wrapper/sccache config caused the output to land elsewhere.

Common situations: Developers with `CARGO_TARGET_DIR` set in their shell or `.cargo/config.toml` cache/share setups; build script errors swallowed by a successful-looking cargo exit.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/7730a6b9c0ca98cc. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/check/component_examples.rs:425

        bail!("Failed to build Vector for example validation")
    }

    let target_dir = std::env::var_os("CARGO_TARGET_DIR").map_or_else(
        || repo_root.join("target"),
        |path| {
            let path = PathBuf::from(path);
            if path.is_absolute() {
                path
            } else {
                repo_root.join(path)
            }
        },
    );
    let vector_bin = target_dir
        .join("debug")
        .join(format!("vector{}", std::env::consts::EXE_SUFFIX));
    if !vector_bin.is_file() {
        bail!(
            "Vector build completed but the binary was not found at {}",
            vector_bin.display()
        )
    }
    Ok(vector_bin)
}

fn validate_case(repo_root: &Path, vector_bin: &Path, case: &ValidationCase) -> Result<()> {
    let temporary = Builder::new()
        .prefix("vector-validate-example-")
        .suffix(".yaml")
        .tempfile()
        .context("Failed to create a temporary validation file")?;
    serde_yaml::to_writer(temporary.as_file(), &case.config)
        .with_context(|| format!("Failed to serialize {}", case.key))?;

    let output = Command::new(vector_bin)
        .current_dir(repo_root)

View on GitHub (pinned to bdb87aeaa4)