astrid-runtime/astrid · error

--git-history requires non-empty NAME=REPO::RELATIVE_PATH

Error message

--git-history requires non-empty NAME=REPO::RELATIVE_PATH

What it means

`parse_git_specification` splits the value after `NAME=PATH` on `::` into repository and relative path, and bails when either side is empty. A git-history corpus must name both a repository directory and an in-repo path.

Source

Thrown at crates/astrid-storage-chunker-evidence/src/main.rs:209

    Ok(Options {
        corpus_specs,
        version_chain_specs,
        git_history_specs,
        include_synthetic,
        sketch_only,
        targets_kib,
        output,
    })
}

fn parse_git_specification(specification: Option<String>) -> Result<(String, PathBuf, PathBuf)> {
    let (name, combined) = parse_path_specification("--git-history", specification)?;
    let combined = combined.to_string_lossy();
    let (repository, relative_path) = combined
        .split_once("::")
        .ok_or_else(|| anyhow::anyhow!("--git-history requires NAME=REPO::RELATIVE_PATH"))?;
    if repository.is_empty() || relative_path.is_empty() {
        bail!("--git-history requires non-empty NAME=REPO::RELATIVE_PATH");
    }
    Ok((
        name,
        PathBuf::from(repository),
        PathBuf::from(relative_path),
    ))
}

fn parse_path_specification(
    flag: &str,
    specification: Option<String>,
) -> Result<(String, PathBuf)> {
    let specification =
        specification.ok_or_else(|| anyhow::anyhow!("{flag} requires NAME=PATH"))?;
    let (name, path) = specification
        .split_once('=')
        .ok_or_else(|| anyhow::anyhow!("{flag} requires NAME=PATH"))?;
    if name.is_empty() || path.is_empty() {

View on GitHub (pinned to affd8760f4)

Solutions

  1. Supply both parts in full: `--git-history samples=/path/to/repo::relative/file.bin`
  2. Check the shell variable holding the path isn't empty (`echo "$SPEC"`) before invoking
  3. Use a relative in-repo path for the part after `::`

Example fix

// before
SPEC="samples=/srv/repo::"; bin --git-history "$SPEC"
// after
SPEC="samples=/srv/repo::bench/corpus/sample.bin"; bin --git-history "$SPEC"
Defensive patterns

Strategy: validation

Validate before calling

fn valid_git_spec(spec: &str) -> bool {
    let (name, rest) = match spec.split_once('=') { Some(x) => x, None => return false };
    let (repo, rel) = match rest.split_once("::") { Some(x) => x, None => return false };
    !name.is_empty() && !repo.is_empty() && !rel.is_empty()
}
assert!(valid_git_spec(&spec), "malformed --git-history spec: {spec}");

Try / catch

match run_cli(args) {
    Err(e) if e.to_string().contains("NAME=REPO::RELATIVE_PATH") => {
        eprintln!("{e}; quoting spec: --git-history 'samples=/repo::path/file.bin'");
        std::process::exit(2);
    }
    other => other,
}

Prevention

When it happens

Trigger: Passing `--git-history name=repo::` (empty relative path), `--git-history name=::path` (empty repo), or in `parse_path_specification` a value missing `NAME=PATH` structure entirely.

Common situations: Truncated shell variables (`REPO::` with unset path), copy-paste losing characters, Windows drive letters being mistaken as separators, or scripts joining paths incorrectly.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/f08f15d67f81244c. Report an issue: GitHub.