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 installer that streams progress directly to stdout/stderr, which would corrupt a structured --output-format json stream (and vice versa). The command therefore rejects JSON output up front (out.for_json() is Some) and points automated flows at the standalone installer documented at https://docs.gitbutler.com/installation.

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 caf1f223d3)

Solutions

  1. Drop --output-format json when invoking `but update install`
  2. For automated installs, use the standalone installer from https://docs.gitbutler.com/installation
  3. Set output format per-command instead of globally so this subcommand stays human-formatted

Example fix

$ but update install --output-format json   # fails
$ but update install                        # interactive OK
# automation: use the standalone installer instead
Defensive patterns

Strategy: validation

Validate before calling

// before invoking programmatically:
if json_output_requested {
    return Err(anyhow::anyhow!("but update install does not support JSON; use the standalone installer"));
}

Prevention

When it happens

Trigger: `but update install --output-format json`, or any invocation where a global JSON output setting or alias makes the output channel JSON.

Common situations: Automation wrapping every but call in a JSON-parsing harness, global output-format config in dotfiles, CI wanting machine-readable update results.

Related errors


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