{"record":{"id":"c6f493fcefdb3c81","repo":"astrid-runtime/astrid","slug":"failed-to-auto-build-capsule-from-cargo-project","errorCode":null,"errorMessage":"Failed to auto-build capsule from Cargo project.","messagePattern":"Failed to auto-build capsule from Cargo project\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install.rs","lineNumber":733,"sourceCode":"                        prompt,\n                        daemon_install_authority(archive, principal, prompt)?,\n                    )\n                    .await?;\n                    return Ok(vec![installed]);\n                }\n                return unpack_via_lib(\n                    &entry.path(),\n                    workspace,\n                    home,\n                    original_source,\n                    principal,\n                    expected,\n                    prompt,\n                )\n                .map(|installed| vec![installed]);\n            }\n        }\n        bail!(\"Failed to auto-build capsule from Cargo project.\");\n    }\n\n    if !workspace {\n        let installed = super::install_daemon::install_local_via_daemon_outcome(\n            source,\n            prompt,\n            daemon_install_authority(source, principal, prompt)?,\n        )\n        .await?;\n        return Ok(vec![installed]);\n    }\n\n    install_from_local_path_for_principal(\n        source_path,\n        workspace,\n        home,\n        original_source,\n        principal,","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install.rs#L715-L751","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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.","Check the Cargo.toml package name and crate configuration match what astrid-build expects for capsule packaging.","Update or reinstall astrid-build so its version matches astrid-cli (they must agree on output naming/layout).","Ensure the build isn't silently skipping packaging (e.g. wrong --type; use `--type rust` as the CLI does).","If astrid-build emits the archive under a nested path, flatten the output or fix the build script."],"exampleFix":"// before (Cargo.toml)\n[lib]\npath = \"src/lib.rs\"   // lib-only crate; astrid-build emits no .capsule\n// after\n[package]\nname = \"my-capsule\"\n[lib]\ncrate-type = [\"cdylib\"]  // produce the binary artifact astrid-build packages","handlingStrategy":"validation","validationCode":"let out = std::path::Path::new(\"/tmp/dist\");\n// run: astrid-build <dir> --output /tmp/dist --type rust\nlet produced = std::fs::read_dir(out)?.filter_map(Result::ok)\n    .any(|e| e.path().extension().and_then(|s| s.to_str()) == Some(\"capsule\"));\nassert!(produced, \"astrid-build produced no .capsule archive\");","typeGuard":null,"tryCatchPattern":"astrid-build \"$DIR\" --output /tmp/dist --type rust || exit 1\nls /tmp/dist/*.capsule >/dev/null 2>&1 || { echo 'no .capsule artifact produced'; exit 1; }","preventionTips":["Verify the project's Cargo.toml produces a packageable artifact (correct crate-type).","Keep astrid-build in sync with astrid-cli versions.","Smoke-test `astrid-build <dir> --output out/ --type rust` when setting up a new capsule project.","Inspect the build output directory when upgrading toolchains."],"tags":["cli","build","artifact","install"],"backgroundTag":"file-not-found","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}