GitoxideLabs/gitoxide · error · anyhow::Error

JSON output isn't implemented yet

Error message

JSON output isn't implemented yet

What it means

`gix merge tree` only supports human output; a non-Human OutputFormat raises this bail immediately. Additionally the same function enforces related option rules, but this specific error is purely the format gate.

Solutions

  1. Use the default human output format
  2. Parse the human/debug output instead (conflicts are dumped with `{:#?}`)
  3. Implement or request JSON support upstream

Example fix

// before
$ gix merge tree --format json ours theirs
// after
$ gix merge tree ours theirs
Defensive patterns

Strategy: validation

Validate before calling

if format != OutputFormat::Human {
    // use human output for merge tree
}

Try / catch

match result {
    Err(e) if e.to_string().contains("JSON output isn't implemented") =>
        eprintln!("re-run with human output"),
    other => other?,
}

Prevention

When it happens

Trigger: Running `gix merge tree --format json ...`; the `format != OutputFormat::Human` check bails before validating `--update-head`/`--in-memory`/`--message` combinations.

Common situations: Scripted tree merges wanting JSON output; sharing one `--format` flag across subcommands; automation parsing merge results.

Related errors


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

Appendix: source

Thrown at gitoxide-core/src/repository/merge/tree.rs:45

    pub fn tree(
        mut repo: gix::Repository,
        out: &mut dyn std::io::Write,
        err: &mut dyn std::io::Write,
        base: BString,
        ours: BString,
        theirs: BString,
        Options {
            format,
            file_favor,
            tree_favor,
            in_memory,
            debug,
            message,
            update_head,
        }: Options,
    ) -> anyhow::Result<()> {
        if format != OutputFormat::Human {
            bail!("JSON output isn't implemented yet");
        }
        if update_head && in_memory {
            bail!("`--update-head` cannot be used with `--in-memory` - cannot set head to nothing");
        }
        if update_head && message.is_none() {
            bail!("`--update-head` requires `--message`");
        }
        repo.object_cache_size_if_unset(repo.compute_object_cache_size_for_tree_diffs(&**repo.index_or_empty()?));
        if in_memory || message.is_some() {
            repo.objects.enable_object_memory();
        }
        let (base_ref, base_id) = refname_and_tree(&repo, base)?;
        let (ours_ref, ours_id) = refname_and_tree(&repo, ours)?;
        let (theirs_ref, theirs_id) = refname_and_tree(&repo, theirs)?;

        let options = repo
            .tree_merge_options()?
            .with_file_favor(file_favor)

View on GitHub (pinned to e73179060b)