astrid-runtime/astrid · error
empty archive path
Error message
empty archive path
What it means
`validate_archive_path` rejects an empty string before any path checks, since an empty archive path cannot name a capsule. This is a guard so downstream pack logic always receives a usable destination path.
Source
Thrown at crates/astrid-cli/src/commands/distro/shuttle.rs:254
.with_context(|| format!("failed to unpack {}", out_path.display()))?;
}
Ok(())
}
/// The archive-relative path of a capsule member: `capsules/<name>.capsule`.
pub(crate) fn capsule_member_path(name: &str) -> String {
format!("{CAPSULES_DIR}/{name}.capsule")
}
/// The on-disk path of a capsule inside an unpacked mirror.
pub(crate) fn capsule_mirror_path(mirror: &Path, name: &str) -> PathBuf {
mirror.join(CAPSULES_DIR).join(format!("{name}.capsule"))
}
/// Reject archive paths that are absolute, contain `..`, or are empty.
fn validate_archive_path(path: &str) -> anyhow::Result<()> {
if path.is_empty() {
bail!("empty archive path");
}
let p = Path::new(path);
if p.is_absolute() || p.components().any(|c| matches!(c, Component::ParentDir)) {
bail!("unsafe archive path '{path}'");
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
fn sample_entries() -> Vec<ShuttleEntry> {
vec![
ShuttleEntry {
path: SIG_NAME.to_string(),
content: ShuttleContent::Bytes(b"deadbeef".to_vec()),
},View on GitHub (pinned to affd8760f4)
Solutions
- Pass a non-empty output path, e.g. `--out distro/my.capsule`.
- Fix the script/config so the path variable is populated (quote and check it: `: "${OUT:?OUT is empty}"`).
- Rely on the default destination (mirrors `<name>.capsule`) by omitting the path argument instead of passing an empty one.
Example fix
// before
$ astrid distro pack --out "$CAPSULE" # CAPSULE empty
// after
$ : "${CAPSULE:?set CAPSULE}" && astrid distro pack --out "$CAPSULE" Defensive patterns
Strategy: validation
Validate before calling
if out_path.trim().is_empty() {
eprintln!("--out path is required");
std::process::exit(2);
} Try / catch
match pack(&staging, out) {
Err(e) if e.to_string().contains("empty archive path") => {
eprintln!("supply a non-empty --out path, e.g. --out my.capsule");
}
other => other?,
} Prevention
- Always pass an explicit, quoted --out value
- Use `${VAR:?msg}` in scripts to catch unset path variables
- Omit the flag to use the default destination instead of passing ""
When it happens
Trigger: Calling `pack` (which calls `validate_archive_path`) with an empty output/`--out` path argument, e.g. `astrid distro pack --out ""`.
Common situations: A shell variable holding the output path is unset/empty (e.g. `--out "$OUT"` with `OUT=`); a script generating the path from an empty config field.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- unsafe archive path '{path}'
- capsule '{}': tag must not be empty
- Distro.toml has no parent directory
- capsule source is neither a directory nor a regular file: {}
- {name} not found. Ensure it is installed alongside the astri
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/c16116d1546363f3.
Report an issue: GitHub.