gitbutlerapp/gitbutler · error

' ' no found

Error message

'{raw_id}' no found

What it means

When rendering hunks, each raw hunk id is parsed against the context; the mapping must resolve to exactly one hunk. If it resolves to zero, the code bails with "'<raw_id>' no found" (a typo for 'not found'). This means the given id no longer matches any hunk in the current diff state.

Solutions

  1. Re-run the listing command (e.g. `but status`) to get fresh hunk ids and use those.
  2. Verify the id spelling — the message quotes exactly what failed to resolve.
  3. Refresh workspace state (the id map is context-dependent) and retry once the tree is stable.

Example fix

// before (stale id from earlier output)
but unapply hunk_a1b2
// after
but status            # capture current hunk ids
but unapply <current-hunk-id>
Defensive patterns

Strategy: retry

Validate before calling

# refresh ids before use; never reuse ids from stale output
fresh_ids=$(but status --json | jq -r '.hunks[].id')
echo "$fresh_ids" | grep -qx "$HUNK_ID" || { echo "stale id"; exit 1; }

Try / catch

if ! but apply "$HUNK_ID" 2>/dev/null; then
  HUNK_ID=$(but status --json | jq -r '.hunks[].id' | head -1)
  but apply "$HUNK_ID"
fi

Prevention

When it happens

Trigger: Passing a hunk id that the IdMap cannot resolve: the hunk was edited/committed/staged since the id was captured, the id is stale from a previous `but` output, or it was mistyped.

Common situations: Scripting against `but` output ids after the working tree changed; reusing ids from an old status listing; typos in hunk ids; concurrently modifying files while constructing the command.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/3e3dd2ac564380ea. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/utils/diff_rendering.rs:1406

fn filter_uncommitted_hunks<'a, F>(
    ctx: &'a Context,
    id_map: &'a IdMap,
    mut filter: F,
) -> anyhow::Result<Vec<(&'a str, Arc<CliId>, &'a UncommittedHunk)>>
where
    F: FnMut(&UncommittedHunk) -> bool,
{
    let mut uncommitted_hunks = id_map
        .uncommitted_hunks
        .iter()
        .filter(move |(_, hunk)| filter(hunk))
        .map(|(raw_id, hunk)| {
            let mut cli_ids = id_map.parse_using_context(raw_id, ctx)?;
            if cli_ids.len() == 1 {
                Ok((&**raw_id, Arc::new(cli_ids.remove(0)), hunk))
            } else if cli_ids.is_empty() {
                bail!("'{raw_id}' no found")
            } else {
                bail!(
                    "'{raw_id}' resolved to more than one hunk ({})",
                    cli_ids.len()
                )
            }
        })
        .collect::<anyhow::Result<Vec<_>>>()?;

    uncommitted_hunks.sort_by(|(id_a, _, hunk_a), (id_b, _, hunk_b)| {
        (
            &hunk_a.hunk.path,
            hunk_a
                .hunk
                .hunk_header
                .as_ref()
                .map(|header| header.old_start),
            id_a,

View on GitHub (pinned to 58e5313667)