astrid-runtime/astrid · error
astrid-build failed with exit code {}
Error message
astrid-build failed with exit code {} What it means
After a successful clone, `clone_and_build` invokes the companion binary `astrid-build` (via `find_companion_binary`) to build the capsule from source, and bails with this message when the build subprocess exits non-zero. The exit code is surfaced via `status.code().unwrap_or(1)` so callers can see how the build failed; the build tool's own output is on stderr.
Source
Thrown at crates/astrid-cli/src/commands/capsule/install.rs:588
.status()
.context("Failed to spawn git clone")?;
if !status.success() {
bail!("Failed to clone repository from GitHub.");
}
let output_dir = tmp_dir.path().join("dist");
std::fs::create_dir_all(&output_dir)?;
let build_bin = crate::bootstrap::find_companion_binary("astrid-build")?;
let build_status = std::process::Command::new(build_bin)
.arg(clone_dir.to_str().context("Invalid clone dir path")?)
.arg("--output")
.arg(output_dir.to_str().context("Invalid output dir path")?)
.status()
.context("Failed to run astrid-build")?;
if !build_status.success() {
bail!(
"astrid-build failed with exit code {}",
build_status.code().unwrap_or(1)
);
}
// Surface (not swallow) a per-entry read error rather than silently
// dropping a file with `filter_map(Result::ok)` — a transient I/O or
// permissions error on one entry should be reported, not hide a capsule
// the operator expects to be installed.
let mut produced: Vec<std::path::PathBuf> = Vec::new();
for entry in std::fs::read_dir(&output_dir)? {
let entry = match entry {
Ok(e) => e,
Err(err) => {
eprintln!("warning: skipping unreadable build-output entry: {err}");
continue;
},
};View on GitHub (pinned to affd8760f4)
Solutions
- Re-run the install with build output visible and inspect `astrid-build`'s stderr for the actual compile/build error
- Update the `astrid-build` companion binary to a version matching the capsule source's expected build tooling
- Build the capsule manually in the cloned temp dir with `astrid-build` to iterate on the underlying build error
- Install missing system/toolchain dependencies the capsule build requires, or fix the capsule source itself if you maintain it
Example fix
// before: stale astrid-build can't compile the capsule $ astrid capsule install github:org/repo astrid-build failed with exit code 101 // after: update the companion binary, then retry $ astrid bootstrap update astrid-build $ astrid capsule install github:org/repo
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure astrid-build companion binary exists and works before install
let bin = find_companion_binary("astrid-build")?;
let ok = std::process::Command::new(bin)
.arg("--version")
.status()
.map(|s| s.success())
.unwrap_or(false);
if !ok { eprintln!("astrid-build missing or broken; update it before installing from source"); } Try / catch
match clone_and_build(url, ...) {
Ok(id) => proceed(id),
Err(e) if e.to_string().starts_with("astrid-build failed with exit code") => {
// rerun astrid-build manually on the cloned source to capture
// the full compiler/build diagnostic from stderr
}
Err(e) => return Err(e),
} Prevention
- Keep the `astrid-build` companion binary updated to the version the capsule source expects
- Ensure the build toolchain (compiler, system libs) the capsule needs is installed before source installs
- Run source-based installs with stderr visible so the underlying build error is captured
- Test-build capsules you maintain in CI so broken sources never reach consumers
When it happens
Trigger: Installing a capsule from GitHub source when the `astrid-build` process terminates with a non-zero exit code — e.g. compilation error in the capsule source, missing build dependencies, unsupported capsule layout, or the process was killed by a signal (code defaults to 1).
Common situations: The cloned repo's capsule source doesn't compile (version mismatch with local toolchain); `astrid-build` binary is present but incompatible/outdated; missing system dependencies required by the capsule build; OOM kill during build (no exit code → reported as 1).
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- astrid-build produced no .capsule archive.
- cannot remove capsule authority while an install transaction
- an incomplete capsule authority update exists at {}; remove
- unsupported installed authority schema {}
- installed capsule identity/version differs from its authorit
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/700327a4765066a5.
Report an issue: GitHub.