astrid-runtime/astrid · error

keypair {:?} not found

Error message

keypair {:?} not found

What it means

`run_show` requires the keypair's metadata file to exist. If `<name>.meta` is missing the keypair is considered nonexistent and the command bails. Note this checks only the meta file, so a partially-deleted keypair still reports 'not found'.

Source

Thrown at crates/astrid-cli/src/commands/keypair.rs:303

    println!(
        "{:<24} {:<71} {:<10}  BOUND PRINCIPAL",
        "NAME", "FINGERPRINT", "CREATED",
    );
    for entry in entries {
        let bound = entry.meta.bound_principal.as_deref().unwrap_or("-");
        println!(
            "{:<24} {:<71} {:<10}  {}",
            entry.name, entry.meta.fingerprint, entry.meta.created_at_epoch, bound,
        );
    }
    Ok(ExitCode::SUCCESS)
}

fn run_show(args: &ShowArgs) -> Result<ExitCode> {
    validate_name(&args.name)?;
    let paths = KeyPaths::new(&args.name)?;
    if !paths.meta.exists() {
        bail!("keypair {:?} not found", args.name);
    }
    let meta = read_meta(&paths)?;
    let pub_hex = read_public(&paths.public_hex).unwrap_or_else(|_| "<missing>".to_string());
    println!("name:            {}", args.name);
    println!("fingerprint:     {}", meta.fingerprint);
    println!("created (epoch): {}", meta.created_at_epoch);
    println!("backend:         {}", meta.backend);
    if let Some(p) = &meta.bound_principal {
        println!("bound principal: {p}");
    }
    if let Some(n) = &meta.note {
        println!("note:            {n}");
    }
    println!("public key (hex): {pub_hex}");
    println!("private path:    {}", paths.private.display());
    Ok(ExitCode::SUCCESS)
}

View on GitHub (pinned to affd8760f4)

Solutions

  1. List existing keypairs (e.g. `astrid keypair list`) to see the correct name.
  2. Create the keypair with `astrid keypair generate <name>` if it never existed.
  3. Check the key directory path (env/home) — you may be pointing at the wrong location.
  4. Fix any typos in the name passed to --name.

Example fix

// before
astrid keypair show prod-key
// after
astrid keypair list          # find correct name
astrid keypair show prod_key
Defensive patterns

Strategy: validation

Validate before calling

astrid keypair list | grep -qx "$NAME" || { echo "keypair $NAME missing" >&2; exit 1; }

Prevention

When it happens

Trigger: `astrid keypair show <name>` where the meta file for <name> does not exist — name typo, keypair never generated, or deleted/moved key directory.

Common situations: Typo in keypair name; running on a different machine or under a different user/home where keys live elsewhere; ASTRID key directory env pointing to the wrong path; cleanup scripts removed the keys.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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