GitoxideLabs/gitoxide · error

JSON output isn't implemented yet

Error message

JSON output isn't implemented yet

What it means

`gitoxide_core::repository::worktree::list` has not implemented JSON serialization for worktree information. If `format` is anything but `OutputFormat::Human`, it bails with this message before inspecting any worktrees. The error signals an unimplemented feature rather than invalid input.

Solutions

  1. Use `OutputFormat::Human` / omit the format flag for `worktree list`.
  2. Enumerate worktrees via the `gix` library (`repo.main_repo()?.worktree()`, `$GIT_DIR/worktrees`) and serialize yourself.
  3. Parse the tabular human output in your tooling as an interim measure.
  4. Contribute or wait for JSON implementation upstream in gitoxide-core.

Example fix

// before
core::repository::worktree::list(repo, &mut out, OutputFormat::Json)?;
// after
core::repository::worktree::list(repo, &mut out, OutputFormat::Human)?;
Defensive patterns

Strategy: validation

Validate before calling

if format != OutputFormat::Human { format = OutputFormat::Human; // worktree list JSON is not implemented }

Type guard

fn worktree_json_available(f: &OutputFormat) -> bool { matches!(f, OutputFormat::Human) }

Try / catch

match worktree::list(&repo, &mut out, format) { Err(e) if e.to_string().contains("JSON output isn't implemented") => worktree::list(&repo, &mut out, OutputFormat::Human), other => other }

Prevention

When it happens

Trigger: Calling `worktree::list(repo, out, OutputFormat::Json)`, or running `gix worktree list --format json` (any non-Human format) via the CLI.

Common situations: Automating worktree inventories and expecting JSON like other list subcommands; CI scripts that uniformly request JSON output; wrappers built before verifying format support.

Related errors


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

Appendix: source

Thrown at gitoxide-core/src/repository/worktree.rs:9

use anyhow::bail;
use gix::prelude::ObjectIdExt;
use unicode_width::UnicodeWidthStr;

use crate::OutputFormat;

pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write, format: OutputFormat) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("JSON output isn't implemented yet");
    }
    let main_repo = repo.main_repo()?;
    let mut worktrees = Vec::new();

    if let Some(worktree) = main_repo.worktree() {
        worktrees.push(create_worktree_info(&main_repo, gix::path::realpath(worktree.base())?)?);
    }

    for proxy in main_repo.worktrees()? {
        let base = gix::path::realpath(proxy.base()?)?;

        match proxy.into_repo() {
            Ok(worktree_repo) => {
                worktrees.push(create_worktree_info(&worktree_repo, base)?);
            }
            Err(_) => {
                worktrees.push(create_inaccessible_worktree_info(&repo, base));
            }

View on GitHub (pinned to e73179060b)