GitoxideLabs/gitoxide · error · anyhow::Error

Only 'human' format is currently supported

Error message

Only 'human' format is currently supported

What it means

The `gix repo merge-base` command only implements human-readable output (one base id per line). If any other `OutputFormat` (e.g. JSON) is requested, it bails with this message because the formatter was never implemented.

Solutions

  1. Use the default human format and parse the printed object ids.
  2. Parse the commit ids from stdout lines instead of relying on structured output.
  3. Request/implement JSON support in `merge_base` if structured output is required.

Example fix

// before
gix repo merge-base --format json HEAD feature
// after
gix repo merge-base HEAD feature  # one id per line
Defensive patterns

Strategy: validation

Validate before calling

if format != OutputFormat::Human {
    eprintln!("merge-base supports human output only");
    format = OutputFormat::Human; // or refuse early
}

Try / catch

match merge_base(repo, first, others, out, format) {
    Err(e) if e.to_string().contains("Only 'human' format") => fallback_to_human_parsing(),
    r => r?,
}

Prevention

When it happens

Trigger: Calling `merge_base()` in gitoxide-core/src/repository/merge_base.rs with `format != OutputFormat::Human`.

Common situations: Scripts passing a global `--format json` flag for machine parsing; callers assuming every gitoxide subcommand supports JSON output.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/dc0a055d65592cde. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/repository/merge_base.rs:13

use anyhow::bail;

use crate::OutputFormat;

pub fn merge_base(
    mut repo: gix::Repository,
    first: String,
    others: Vec<String>,
    mut out: impl std::io::Write,
    format: OutputFormat,
) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("Only 'human' format is currently supported");
    }
    repo.object_cache_size_if_unset(50 * 1024 * 1024);
    let first_id = commit_id(&repo, first.as_str())?;
    let other_ids: Vec<_> = others
        .iter()
        .map(|other| commit_id(&repo, other.as_str()))
        .collect::<Result<_, _>>()?;

    let cache = repo.commit_graph_if_enabled()?;
    let mut graph = repo.revision_graph(cache.as_ref());
    let bases = repo.merge_bases_many_with_graph(first_id, &other_ids, &mut graph)?;
    if bases.is_empty() {
        bail!("No base found for {first} and {others}", others = others.join(", "))
    }
    for id in bases {
        writeln!(&mut out, "{id}")?;
    }
    Ok(())

View on GitHub (pinned to e73179060b)