{"record":{"id":"7730a6b9c0ca98cc","repo":"vectordotdev/vector","slug":"vector-build-completed-but-the-binary-was-not-found-at","errorCode":null,"errorMessage":"Vector build completed but the binary was not found at {}","messagePattern":"Vector build completed but the binary was not found at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/check/component_examples.rs","lineNumber":425,"sourceCode":"        bail!(\"Failed to build Vector for example validation\")\n    }\n\n    let target_dir = std::env::var_os(\"CARGO_TARGET_DIR\").map_or_else(\n        || repo_root.join(\"target\"),\n        |path| {\n            let path = PathBuf::from(path);\n            if path.is_absolute() {\n                path\n            } else {\n                repo_root.join(path)\n            }\n        },\n    );\n    let vector_bin = target_dir\n        .join(\"debug\")\n        .join(format!(\"vector{}\", std::env::consts::EXE_SUFFIX));\n    if !vector_bin.is_file() {\n        bail!(\n            \"Vector build completed but the binary was not found at {}\",\n            vector_bin.display()\n        )\n    }\n    Ok(vector_bin)\n}\n\nfn validate_case(repo_root: &Path, vector_bin: &Path, case: &ValidationCase) -> Result<()> {\n    let temporary = Builder::new()\n        .prefix(\"vector-validate-example-\")\n        .suffix(\".yaml\")\n        .tempfile()\n        .context(\"Failed to create a temporary validation file\")?;\n    serde_yaml::to_writer(temporary.as_file(), &case.config)\n        .with_context(|| format!(\"Failed to serialize {}\", case.key))?;\n\n    let output = Command::new(vector_bin)\n        .current_dir(repo_root)","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/check/component_examples.rs#L407-L443","documentation":"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.","triggerScenarios":"`CARGO_TARGET_DIR` points somewhere unexpected, a previous clean removed the binary, or a build wrapper/sccache config caused the output to land elsewhere.","commonSituations":"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.","solutions":["Verify the binary exists at the path printed in the error.","Check `CARGO_TARGET_DIR` in the environment and `.cargo/config.toml` for overridden target directories.","Re-run the build with `cargo build --bin vector` and inspect where the output lands."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"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));\nassert!(bin.is_file(), \"binary missing at {bin:?}\");","typeGuard":"fn vector_binary_present() -> bool {\n    let dir = std::env::var_os(\"CARGO_TARGET_DIR\").map(PathBuf::from).unwrap_or_else(|| PathBuf::from(\"target\"));\n    dir.join(\"debug\").join(format!(\"vector{}\", std::env::consts::EXE_SUFFIX)).is_file()\n}","tryCatchPattern":null,"preventionTips":["Avoid overriding CARGO_TARGET_DIR when running vdev checks, or unset it for the check.","Verify `cargo build --bin vector` output location when using build wrappers like sccache.","Build once explicitly before running validation so the binary path is known."],"tags":["build","filesystem","cargo"],"backgroundTag":"file-not-found","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}