GitoxideLabs/gitoxide · error

Only human output is currently supported

Error message

Only human output is currently supported

What it means

Guard at the start of `commitgraph::list`, which prints commitgraph entries (commit IDs, generation numbers, parents) for a rev-spec. The function only renders human-readable text; a non-Human OutputFormat triggers this bail before the repository walk begins. It fires when `gix repo commit-graph list --format json` (or another machine format) is requested and is a not-yet-implemented feature signal rather than a runtime failure of the graph itself.

Solutions

  1. Use `OutputFormat::Human`
  2. Read the commit-graph files via `gix::repository::commit_graph_if_enabled` in your own code and serialize yourself
  3. Request/track JSON support upstream

Example fix

// before
list(repo, spec, &mut out, long_hashes, OutputFormat::Json)?;
// after
list(repo, spec, &mut out, long_hashes, OutputFormat::Human)?;
Defensive patterns

Strategy: validation

Validate before calling

if format != gix::output_format::OutputFormat::Human {
    anyhow::bail!("commitgraph list supports only human output");
}

Prevention

When it happens

Trigger: Calling `list` with `OutputFormat::Json` (e.g. `gix commitgraph list --format json`).

Common situations: Automating commit-graph inspection with structured output; tooling that uniformly passes `--format json` to all gix subcommands.

Related errors


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

Appendix: source

Thrown at gitoxide-core/src/repository/commitgraph/list.rs:18

pub(crate) mod function {
    use crate::OutputFormat;
    use crate::repository::HexId;
    use anyhow::{Context, bail};
    use gix::odb::store::RefreshMode;
    use gix::revision::plumbing::Spec;
    use gix::{prelude::ObjectIdExt, revision::walk::Sorting};
    use std::{borrow::Cow, ffi::OsString};

    pub fn list(
        mut repo: gix::Repository,
        spec: OsString,
        mut out: impl std::io::Write,
        long_hashes: bool,
        format: OutputFormat,
    ) -> anyhow::Result<()> {
        if format != OutputFormat::Human {
            bail!("Only human output is currently supported");
        }
        let graph = repo
            .commit_graph_if_enabled()
            .context("a commitgraph is required, but none was found")?;
        repo.object_cache_size_if_unset(4 * 1024 * 1024);
        repo.objects.refresh = RefreshMode::Never;

        let spec = gix::path::os_str_into_bstr(&spec)?;
        let spec = repo.rev_parse(spec)?.detach();
        let commits = match spec {
            Spec::Include(id) => connected_commit_id(&repo, id)?
                .ancestors()
                .sorting(Sorting::ByCommitTime(Default::default()))
                .all()?,
            Spec::Range { from, to } => connected_commit_id(&repo, to)?
                .ancestors()
                .sorting(Sorting::ByCommitTime(Default::default()))
                .with_hidden(Some(connected_commit_id(&repo, from)?))

View on GitHub (pinned to e73179060b)