gitbutlerapp/gitbutler · warning · anyhow::Error

Could not determine which accounts to delete

Error message

Could not determine which accounts to delete

What it means

In the account-forget flow, the user is shown their stored forge accounts in a multi-select picker; this error occurs when prompt_multi_select returns None — the picker was cancelled outright (as opposed to an empty confirmed selection, which is handled gracefully with 'No accounts were selected to forget.'). So the error strictly means 'picker aborted', not 'nothing selected'.

Source

Thrown at crates/but/src/command/config.rs:1356

        }
        _ => {
            // Multiple accounts: prompt user to select
            let Some(mut input) = out.prepare_for_terminal_input() else {
                anyhow::bail!("Username ambiguous, got {accounts_to_delete:?}");
            };
            let account_options = accounts_to_delete
                .into_iter()
                .map(|account| (account.to_string(), account))
                .collect::<Vec<_>>();
            let account_options = nonempty::NonEmpty::from_vec(account_options)
                .context("No accounts available to forget")?;

            let selected_accounts = input
                .prompt_multi_select(
                    "Which of the following accounts do you want to forget?",
                    &account_options,
                )?
                .ok_or_else(|| anyhow::anyhow!("Could not determine which accounts to delete"))?;

            if selected_accounts.is_empty() {
                writeln!(input, "No accounts were selected to forget.")?;
                return Ok(());
            }

            for account in selected_accounts {
                forget_account(account)?;
                writeln!(input, "Forgot forge account '{account}'")?;
            }
        }
    }

    Ok(())
}

fn ai_config_with_repo(
    ctx: &mut Context,

View on GitHub (pinned to caf1f223d3)

Solutions

  1. If you want to forget nothing, confirm an empty selection with Enter — that path prints 'No accounts were selected to forget.' and exits cleanly.
  2. If you do want to forget accounts, space-select them and press Enter.
  3. Treat this error as harmless: nothing was modified.
Defensive patterns

Strategy: try-catch

Try / catch

match forget_accounts(out) {
    Err(e) if e.to_string().contains("Could not determine which accounts to delete") => {
        Ok(()) // picker aborted; no accounts were touched
    }
    other => other,
}

Prevention

When it happens

Trigger: Running the forget-account command, then pressing Esc/Ctrl-C in the multi-select instead of confirming a (possibly empty) selection with Enter.

Common situations: User opens the forget dialog just to look at stored accounts and backs out with Esc.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/9964a2d8606b92ec. Report an issue: GitHub.