GitoxideLabs/gitoxide · info · anyhow::Error

Only human output is supported for now

Error message

Only human output is supported for now

What it means

`gix submodule list` only supports human-readable output; a non-Human OutputFormat (e.g. JSON) makes `list` bail before enumerating submodules. JSON serialization for submodule listings is not yet implemented in gitoxide-core.

Solutions

  1. Use the default human output for `gix submodule list`
  2. Use `git submodule status --recursive` for a script-parseable listing today
  3. Read submodules programmatically via the `gix` library (`repo.submodules()`)
  4. Watch for JSON support being added in future gitoxide releases

Example fix

// before
gix submodule list --format json
// after
gix submodule list
Defensive patterns

Strategy: validation

Validate before calling

[ "$fmt" = "human" ] || { echo "submodule list supports only human output" >&2; exit 2; }

Try / catch

if ! gix submodule list --format json 2>err.log; then
  grep -q 'Only human output' err.log && gix submodule list
fi

Prevention

When it happens

Trigger: Calling `gix submodule list --format json` — the check at the top of `list` in gitoxide-core/src/repository/submodule.rs rejects any format besides OutputFormat::Human.

Common situations: Automation wanting machine-readable submodule inventories; users expecting feature parity with other JSON-capable gix subcommands; CI tooling parsing submodule state.

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

Appendix: source

Thrown at gitoxide-core/src/repository/submodule.rs:13

use anyhow::bail;
use gix::{Repository, Submodule, commit::describe::SelectRef, prelude::ObjectIdExt};

use crate::OutputFormat;

pub fn list(
    repo: Repository,
    mut out: impl std::io::Write,
    format: OutputFormat,
    dirty_suffix: Option<String>,
) -> anyhow::Result<()> {
    if format != OutputFormat::Human {
        bail!("Only human output is supported for now")
    }

    let Some(submodules) = repo.submodules()? else {
        return Ok(());
    };
    for sm in submodules {
        print_sm(sm, dirty_suffix.as_deref(), &mut out)?;
    }
    Ok(())
}

fn print_sm(sm: Submodule<'_>, dirty_suffix: Option<&str>, out: &mut impl std::io::Write) -> anyhow::Result<()> {
    let _span = gix::trace::coarse!("print_sm", path = ?sm.path());
    let state = sm.state()?;
    let mut sm_repo = sm.open()?;
    if let Some(repo) = sm_repo.as_mut() {
        repo.object_cache_size_if_unset(4 * 1024 * 1024);
    }

View on GitHub (pinned to e73179060b)