GitoxideLabs/gitoxide · error · anyhow::Error

JSON output isn't implemented yet

Error message

JSON output isn't implemented yet

What it means

Guard at the start of `merge::file`, the plumbing entry that runs the builtin file-merge driver over base/ours/theirs contents and prints the conflict outcome. Only human output rendering exists; requesting JSON (or any non-Human format) bails before path normalization and the merge run. It fires on `--format json` style invocations and signals an unimplemented output serializer, not a merge failure.

Solutions

  1. Use the default human output format
  2. Write the three-way merge via the gix library (`gix::merge::blob`) and serialize results yourself
  3. Wait for/ask for JSON support upstream

Example fix

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

Strategy: validation

Validate before calling

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

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 file --format json` (or any non-Human format); the guard `format != OutputFormat::Human` fails immediately.

Common situations: Scripting blob-level merges and wanting structured conflict output; sharing a global `--format` flag; comparing merge tool outputs programmatically.

Related errors


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

Appendix: source

Thrown at gitoxide-core/src/repository/merge/file.rs:27

        builtin_driver::{binary, text::Conflict},
        pipeline::WorktreeRoots,
    },
    object::tree::EntryKind,
};

use crate::OutputFormat;

pub fn file(
    repo: gix::Repository,
    out: &mut dyn std::io::Write,
    format: OutputFormat,
    conflict: Option<gix::merge::blob::builtin_driver::text::Conflict>,
    base: BString,
    ours: BString,
    theirs: BString,
) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("JSON output isn't implemented yet");
    }
    let base = repo.normalize_path(&base)?;
    let ours = repo.normalize_path(&ours)?;
    let theirs = repo.normalize_path(&theirs)?;

    let base_id = repo.rev_parse_single(base.as_ref()).ok();
    let ours_id = repo.rev_parse_single(ours.as_ref()).ok();
    let theirs_id = repo.rev_parse_single(theirs.as_ref()).ok();
    let roots = worktree_roots(base_id, ours_id, theirs_id, repo.workdir())?;

    let mut cache = repo.merge_resource_cache(roots)?;
    let null = repo.object_hash().null();
    cache.set_resource(
        base_id.map_or(null, Id::detach),
        EntryKind::Blob,
        base.as_ref(),
        ResourceKind::CommonAncestorOrBase,
        &repo.objects,

View on GitHub (pinned to e73179060b)