gitbutlerapp/gitbutler · error

JSON output is not supported for 'but update install'. The…

Error message

JSON output is not supported for 'but update install'.

The installation process requires interactive output.
For automated installations, use the standalone installer:
https://docs.gitbutler.com/installation

What it means

`but update install` runs an external installer that writes progress directly to stdout/stderr, which conflicts with JSON output mode. `install` therefore rejects the combination up front and points to the standalone installer for automation.

Solutions

  1. Drop `--json` when running `but update install`.
  2. Use the standalone installer from https://docs.gitbutler.com/installation for automated, non-interactive installs.
  3. Run `but update` (check only) with `--json` if you just need machine-readable update info.

Example fix

// before
but update install --json
// error: JSON output is not supported for 'but update install'.

// after
but update install   # or use the standalone installer in scripts
Defensive patterns

Strategy: validation

Validate before calling

# shell: never pass --json to update install
ARGS=(but update install); for a in "$@"; do [ "$a" = "--json" ] || ARGS+=("$a"); done

Try / catch

but update install 2>err.log || { grep -q 'JSON output is not supported' err.log && echo 'drop --json or use the standalone installer'; }

Prevention

When it happens

Trigger: Running `but update install --json` (any invocation where out.for_json() is Some) on a supported unix, non-packaged distribution.

Common situations: Automation scripts that always pass `--json` to every `but` command; CI update jobs trying to parse the installer output as JSON.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at crates/but/src/command/update.rs:138

            if days == 1 { "day" } else { "days" }
        )?;
    } else if let Some(out) = out.for_json() {
        out.write_value(serde_json::json!({
            "suppressed": true,
            "days": days,
            "hours": hours
        }))?;
    }

    Ok(())
}

#[cfg(all(unix, not(feature = "packaged-but-distribution")))]
fn install(out: &mut OutputChannel, target: Option<String>) -> Result<()> {
    // Installation requires interactive output and cannot be used with JSON mode
    // because the installer writes directly to stdout/stderr
    if out.for_json().is_some() {
        anyhow::bail!(
            "JSON output is not supported for 'but update install'.\n\n\
             The installation process requires interactive output.\n\
             For automated installations, use the standalone installer:\n\
             https://docs.gitbutler.com/installation"
        );
    }

    // Parse target to determine what to install
    let version_request = match target.as_deref() {
        Some("nightly") => VersionRequest::Nightly,
        Some("release") => VersionRequest::Release,
        Some(version_str) => {
            // Specific version - validate and create
            // Wrap validation errors with CLI-specific context
            VersionRequest::from_string(Some(version_str.to_string())).map_err(|e| {
                anyhow::anyhow!(
                    "Invalid version '{version_str}': {e}\n\nValid targets:\n  nightly          Install latest nightly build\n  release          Install latest stable release\n  <version>        Install specific version (e.g., 0.18.7)"
                )

View on GitHub (pinned to 58e5313667)