GitoxideLabs/gitoxide · error · anyhow::Error

Only human output format is supported at the moment

Error message

Only human output format is supported at the moment

What it means

The `gix repo odb entries` command lists all objects in the object database but only supports human-readable output. Requesting any other `OutputFormat` (e.g. JSON) bails, as the serializer was not implemented for this subcommand.

Solutions

  1. Use the default human output and parse the printed object entries.
  2. Enumerate objects via the library API (`repo.objects.iter()`) and serialize them yourself for structured output.
  3. Contribute JSON support to `entries` if machine-readable output is needed.

Example fix

// before
gix repo odb entries --format json
// after
gix repo odb entries  # human-readable listing
Defensive patterns

Strategy: validation

Validate before calling

if format != OutputFormat::Human {
    eprintln!("odb entries supports human output only");
    format = OutputFormat::Human;
}

Try / catch

match odb_entries(repo, format, out) {
    Err(e) if e.to_string().contains("Only human output") => use_library_api_for_json(),
    r => r?,
}

Prevention

When it happens

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

Common situations: Scripts requesting `--format json` for object listings; assuming format parity across gitoxide subcommands.

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/462d87b23376c456. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/repository/odb.rs:268

        )?;

        progress.show_throughput(start);
        if errors.contains(&true) {
            bail!("At least one object couldn't be looked up even though it must exist");
        }
    }

    #[cfg(feature = "serde")]
    {
        serde_json::to_writer_pretty(out, &stats)?;
    }

    Ok(())
}

pub fn entries(repo: gix::Repository, format: OutputFormat, mut out: impl io::Write) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("Only human output format is supported at the moment");
    }

    for object in repo.objects.iter()? {
        let object = object?;
        writeln!(out, "{object}")?;
    }

    Ok(())
}

View on GitHub (pinned to e73179060b)