GitoxideLabs/gitoxide · error

Only human format is supported right now

Error message

Only human format is supported right now

What it means

Thrown by `pack::multi_index::entries` when a non-Human output format is requested. The multi-index entry listing only implements plain-text printing, so JSON or other formats are rejected immediately.

Solutions

  1. Use the default human format (omit the format flag)
  2. Set the format explicitly to human
  3. For machine processing, parse the `oid pack_index pack_offset` text lines

Example fix

// before
gix pack multi-index entries --format json objects/pack/multi-pack-index
// after
gix pack multi-index entries objects/pack/multi-pack-index
Defensive patterns

Strategy: validation

Validate before calling

if format != OutputFormat::Human {
    format = OutputFormat::Human; // multi-index entries supports human only
}

Try / catch

match multi_index::entries(path, format, out) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("Only human format is supported right now") => {
        multi_index::entries(path, OutputFormat::Human, out)?;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `gitoxide_core::pack::multi_index::entries(path, OutputFormat::Json, out)` or the CLI command with `--format json` for a multi-pack-index file.

Common situations: Scripts passing a uniform `--format json` flag to all gix subcommands; expecting the multi-index entries command to support JSON output.

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

Appendix: source

Thrown at gitoxide-core/src/pack/multi_index.rs:84

    #[cfg(feature = "serde")]
    {
        let file = gix::odb::pack::multi_index::File::at(&multi_index_path, None)?;
        serde_json::to_writer_pretty(
            out,
            &info::Statistics {
                path: multi_index_path,
                num_objects: file.num_objects(),
                index_names: file.index_names().to_vec(),
                object_hash: file.object_hash().to_string(),
            },
        )?;
    }
    Ok(())
}

pub fn entries(multi_index_path: PathBuf, format: OutputFormat, mut out: impl std::io::Write) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("Only human format is supported right now");
    }
    let file = gix::odb::pack::multi_index::File::at(multi_index_path, None)?;
    for entry in file.iter() {
        writeln!(out, "{} {} {}", entry.oid, entry.pack_index, entry.pack_offset)?;
    }
    Ok(())
}

View on GitHub (pinned to e73179060b)