GitoxideLabs/gitoxide · error

Cannot print information using 'human' format.

Error message

Cannot print information using 'human' format.

What it means

Thrown by the index information printer (`index::information`) when the output format is `human`. Human formatting was never implemented for index info - the code warns and falls back to JSON first, so a `Human` value reaching the match is a logic hole and bails defensively.

Solutions

  1. Use JSON output format instead - it is the only supported format
  2. Pass `--format json` (or equivalent) on the CLI
  3. In code, pass `OutputFormat::Json` explicitly

Example fix

// before
gix index information --format human ./index
// after
gix index information --format json ./index
Defensive patterns

Strategy: fallback

Validate before calling

// Only Json is supported for index information
let format = if format == OutputFormat::Human {
    OutputFormat::Json
} else {
    format
};

Try / catch

match index::information(/* args, format */) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("Cannot print information using 'human' format") => {
        // retry with JSON
        index::information(/* args, OutputFormat::Json */)?;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling the index information function with `OutputFormat::Human`; in practice only reachable if the pre-match fallback is bypassed or format changes since the fallback happens before the match.

Common situations: Passing `--format human` (or omitting an explicit JSON selection where defaults change) for the `gix index information` command and expecting human-readable 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/fd9a047653d7bec4. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/index/mod.rs:67

    out: impl std::io::Write,
    mut err: impl std::io::Write,
    information::Options {
        index: Options {
            object_hash,
            mut format,
        },
        extension_details,
    }: information::Options,
) -> anyhow::Result<()> {
    use crate::OutputFormat::*;
    #[cfg(feature = "serde")]
    if let Human = format {
        writeln!(err, "Defaulting to JSON printing as nothing else will be implemented.").ok();
        format = Json;
    }
    match format {
        Human => {
            anyhow::bail!("Cannot print information using 'human' format.")
        }
        #[cfg(feature = "serde")]
        Json => {
            let info = information::Collection::try_from_file(parse_file(index_path, object_hash)?, extension_details)?;
            serde_json::to_writer_pretty(out, &info)?;
            Ok(())
        }
    }
}

View on GitHub (pinned to e73179060b)