astrid-runtime/astrid · error

Failed to auto-build capsule from Cargo project.

Error message

Failed to auto-build capsule from Cargo project.

What it means

After astrid-build succeeds for a Cargo project, install_from_local scans the output directory for a produced `.capsule` archive. If the build reported success but no file with a `.capsule` extension is found, the CLI bails with this error. It is an outcome-invariant check: a successful build must yield an installable archive, so its absence means the build pipeline did not produce the expected artifact.

Source

Thrown at crates/astrid-cli/src/commands/capsule/install.rs:733

                        prompt,
                        daemon_install_authority(archive, principal, prompt)?,
                    )
                    .await?;
                    return Ok(vec![installed]);
                }
                return unpack_via_lib(
                    &entry.path(),
                    workspace,
                    home,
                    original_source,
                    principal,
                    expected,
                    prompt,
                )
                .map(|installed| vec![installed]);
            }
        }
        bail!("Failed to auto-build capsule from Cargo project.");
    }

    if !workspace {
        let installed = super::install_daemon::install_local_via_daemon_outcome(
            source,
            prompt,
            daemon_install_authority(source, principal, prompt)?,
        )
        .await?;
        return Ok(vec![installed]);
    }

    install_from_local_path_for_principal(
        source_path,
        workspace,
        home,
        original_source,
        principal,

View on GitHub (pinned to affd8760f4)

Solutions

  1. Run astrid-build manually with a visible output dir (`astrid-build <dir> --output /tmp/dist --type rust`) and inspect /tmp/dist to see what, if anything, was produced.
  2. Check the Cargo.toml package name and crate configuration match what astrid-build expects for capsule packaging.
  3. Update or reinstall astrid-build so its version matches astrid-cli (they must agree on output naming/layout).
  4. Ensure the build isn't silently skipping packaging (e.g. wrong --type; use `--type rust` as the CLI does).
  5. If astrid-build emits the archive under a nested path, flatten the output or fix the build script.

Example fix

// before (Cargo.toml)
[lib]
path = "src/lib.rs"   // lib-only crate; astrid-build emits no .capsule
// after
[package]
name = "my-capsule"
[lib]
crate-type = ["cdylib"]  // produce the binary artifact astrid-build packages
Defensive patterns

Strategy: validation

Validate before calling

let out = std::path::Path::new("/tmp/dist");
// run: astrid-build <dir> --output /tmp/dist --type rust
let produced = std::fs::read_dir(out)?.filter_map(Result::ok)
    .any(|e| e.path().extension().and_then(|s| s.to_str()) == Some("capsule"));
assert!(produced, "astrid-build produced no .capsule archive");

Try / catch

astrid-build "$DIR" --output /tmp/dist --type rust || exit 1
ls /tmp/dist/*.capsule >/dev/null 2>&1 || { echo 'no .capsule artifact produced'; exit 1; }

Prevention

When it happens

Trigger: Running `astrid capsule install <dir>` where <dir> contains Cargo.toml, astrid-build exits 0, but every entry in the temp dist directory has an extension other than `.capsule` (the read_dir loop finds no match).

Common situations: Cargo.toml configured with a package type/name astrid-build doesn't recognize, so it builds but writes no archive; astrid-build version mismatch writing artifacts with a different extension or into a nested subdirectory; a stale/broken astrid-build companion binary found by bootstrap::find_companion_binary; a lib-only crate that produces no capsule artifact.

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 astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/c6f493fcefdb3c81. Report an issue: GitHub.