nikivdev/code · error

Failure '{}' not found. Run `f failure list` to inspect rece

Error message

Failure '{}' not found. Run `f failure list` to inspect recent ids.

What it means

resolve_entry looks up a recorded failure entry by id, file name, or full path among stored failure entries; when no entry matches the given id it throws this anyhow error. It is thrown because run_copy was given a failure identifier that does not exist in the failure store.

Source

Thrown at src/failure.rs:355

    };

    let path_candidate = PathBuf::from(id);
    if (path_candidate.is_absolute() || id.contains(std::path::MAIN_SEPARATOR))
        && path_candidate.exists()
    {
        return load_entry_from_path(&path_candidate);
    }

    let limit = 200;
    recent_entries(limit)?
        .into_iter()
        .find(|entry| {
            entry.id == id
                || entry.path.file_name().and_then(|name| name.to_str()) == Some(id)
                || entry.path.display().to_string() == id
        })
        .ok_or_else(|| {
            anyhow::anyhow!(
                "Failure '{}' not found. Run `f failure list` to inspect recent ids.",
                id
            )
        })
}

fn load_entry_from_path(path: &Path) -> Result<FailureEntry> {
    let content =
        fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
    let record: FailureRecord = serde_json::from_str(&content)
        .with_context(|| format!("failed to parse {}", path.display()))?;
    Ok(FailureEntry {
        id: path
            .file_stem()
            .and_then(|stem| stem.to_str())
            .unwrap_or("failure")
            .to_string(),
        path: path.to_path_buf(),

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f failure list` to see valid recent ids and copy the exact one
  2. Retry using the entry's file name or full path instead of the id
  3. Check that the failure store directory still exists and was not cleaned

Example fix

// before
f copy abc123 outdir
// after
f failure list        # find exact id, e.g. f3a9c2
f copy f3a9c2 outdir
Defensive patterns

Strategy: validation

Validate before calling

let ids: Vec<String> = failure_list_ids();
if !ids.iter().any(|i| i == requested_id) {
    eprintln!("unknown failure id {}; valid: {:?}", requested_id, ids);
    std::process::exit(1);
}

Try / catch

match f_failure_copy(id, out) {
    Err(e) if e.to_string().contains("not found") => eprintln!("run `f failure list` first"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling `f copy` (run_copy) with an id argument that matches no entry's id, file name, or display path in the failure list.

Common situations: Typos in the id, using an id from an older session that was pruned, quoting/pasting errors, or referring to a failure by a name fragment rather than the exact file name or id.

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 nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/ae31b5b6b014d669. Report an issue: GitHub.