gitbutlerapp/gitbutler · error

' ' does not name an uncommitted change or branch; refusing…

Error message

'{s}' does not name an uncommitted change or branch; refusing to absorb everything

What it means

`but absorb <s>` resolves the user's short id string to `CliId`s and filters for uncommitted hunks/files or branches. If the string matches nothing acceptable, the CLI refuses to run absorb rather than defaulting to absorbing everything, raising this error to prevent a destructive over-broad operation.

Solutions

  1. Run `but` (status) and copy the exact id shown for the uncommitted change or branch you want to absorb
  2. Extend the prefix characters until the id resolves uniquely to an uncommitted hunk/file or branch
  3. Verify the change is still uncommitted; commit it or absorb a different id if it is already absorbed
  4. If you truly want to absorb everything, omit the argument (if supported) rather than passing a non-matching id

Example fix

// before: commit id passed, filter matches nothing
but absorb 3f9c  // Error: '3f9c' does not name an uncommitted change or branch

// after: use the uncommitted-change/branch id from `but` status
but absorb a1    // e.g. 'a1' resolves to an uncommitted hunk or branch
Defensive patterns

Strategy: validation

Validate before calling

// verify the prefix resolves to exactly one uncommitted change or branch first
but  # inspect listed CliIds; confirm your prefix matches an UncommittedHunkOrFile or Branch row

Type guard

// before calling absorb, resolve and classify
let ids = cli.resolve(s)?;
if !ids.iter().any(|id| matches!(id, CliId::UncommittedHunkOrFile{..} | CliId::Branch(_))) {
    eprintln!("'{s}' is not an uncommitted change or branch");
    return Ok(());
}

Prevention

When it happens

Trigger: Passing an argument that resolves only to commit ids or other non-absorbable CliId kinds (the filter empties the iterator); typos in the id prefix; referring to a file that is already committed.

Common situations: Typing a partial commit-id instead of a branch/hunk id; using a filename that is already committed so it no longer maps to an uncommitted hunk; after committing everything there are no uncommitted changes to name.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at crates/but/src/command/legacy/absorb.rs:61

    let mut guard = ctx.exclusive_worktree_access();
    let id_map = IdMap::new_from_context(ctx, guard.read_permission())?;
    let source: Option<CliId> = source
        .map(|s| -> anyhow::Result<CliId> {
            // Uncommitted selectors resolve in the uncommitted namespace first
            // so later commits cannot shadow them; branch selectors resolve in
            // the full namespace. A selector that names neither is an error —
            // silently falling back to absorbing everything is never intended.
            let resolved =
                match crate::id::parser::resolve_uncommitted_part(ctx, &id_map, s) {
                    Ok(ids) if !ids.is_empty() => ids,
                    _ => parse_sources(ctx, &id_map, s)?,
                };
            let mut acceptable = resolved.into_iter().filter(|id| {
                matches!(id, CliId::UncommittedHunkOrFile { .. })
                    || matches!(id, CliId::Branch(..))
            });
            let first = acceptable.next().ok_or_else(|| {
                anyhow::anyhow!(
                    "'{s}' does not name an uncommitted change or branch; refusing to absorb everything"
                )
            })?;
            if acceptable.next().is_some() {
                anyhow::bail!(
                    "'{s}' is ambiguous - it matches more than one uncommitted change. Use more characters to disambiguate."
                );
            }
            Ok(first)
        })
        .transpose()?;

    let target = if let Some(source) = source {
        match source {
            CliId::UncommittedHunkOrFile(UncommittedHunkOrFile { hunks, .. }) => {
                // Absorb this particular file
                AbsorptionTarget::Hunks {
                    hunks: hunks.map(|id_and_hunk| id_and_hunk.hunk).into(),

View on GitHub (pinned to 58e5313667)