gitbutlerapp/gitbutler · error

Refusing to directly update {target_display} without confirm

Error message

Refusing to directly update {target_display} without confirmation. Re-run with --yes to confirm.

What it means

`but land` updates the target branch directly, so the CLI prints a warning and asks for confirmation (land/messaging.rs). If the output channel cannot host an interactive prompt — `prepare_for_terminal_input()` returns None under pipes, redirects, or CI — it refuses to run the destructive update without explicit consent and tells you to re-run with `--yes`.

Source

Thrown at crates/but/src/command/legacy/land/messaging.rs:231

            .map(|(name, pr)| format!("{name} (PR #{pr})"))
            .collect::<Vec<_>>()
            .join(", ");
        format!(
            "{action} This closes open pull request(s) {prs}: their remote branches are deleted \
             after landing."
        )
    };

    if let Some(out) = out.for_human() {
        writeln!(out, "{}", theme::get().attention.paint(&warning))?;
    }

    if yes {
        return Ok(());
    }

    let Some(mut inout) = out.prepare_for_terminal_input() else {
        bail!(
            "Refusing to directly update {target_display} without confirmation. Re-run with --yes to confirm."
        );
    };

    let question = if extras.is_empty() {
        format!("Land {branch_name} directly onto {target_display}?")
    } else {
        format!("Land {branch_name} and everything below it directly onto {target_display}?")
    };
    if inout.confirm(question, ConfirmDefault::No)? == Confirm::No {
        bail!("Land cancelled");
    }

    Ok(())
}

/// The open pull-request numbers attached to `branch_name` or any of `lower_segments`. Landing
/// deletes each landed branch's remote copy, which closes the attached reviews on the forge, so

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Re-run with `--yes` once you accept the warning that was printed.
  2. Run in a real terminal (unpiped) to answer the prompt interactively.
  3. In scripts, surface the printed warning to a human first, then run the `--yes` invocation.

Example fix

# before
but land my-feature | tee land.log   # piped output -> refuses without confirmation

# after
but land my-feature --yes | tee land.log
Defensive patterns

Strategy: validation

Validate before calling

# Detect non-interactive contexts and pass --yes deliberately
if ! [ -t 0 ] || ! [ -t 1 ]; then
  but land "$branch" --yes
else
  but land "$branch"
fi

Prevention

When it happens

Trigger: Running `but land <branch>` with stdout/stdin not a usable terminal — scripts, CI pipelines, `but land ... | tee`, cron jobs, non-tty ssh — without `--yes`.

Common situations: Automation that assumed the prompt would auto-accept; piping land output through another command for logging; CI jobs that interact only via captured output.

Related errors


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