GitoxideLabs/gitoxide · error · anyhow::Error
JSON output isn't supported
Error message
JSON output isn't supported
What it means
The `gix tag list` command only supports human-readable output. `gitoxide_core::repository::tag::list` explicitly rejects any `OutputFormat` other than `OutputFormat::Human` with `anyhow::bail!` before enumerating references, because no JSON serialization is implemented for tags. The check happens first so no work is done for an unsupported format.
Solutions
- Use `OutputFormat::Human` (or omit the format flag) when listing tags.
- Parse the human output in your script if you need structured data, e.g. splitting on whitespace/newlines.
- Use `repo.references()?.tags()` via the `gix` library API directly and serialize the results yourself.
- Check `gix`/gitoxide-core release notes for when JSON support for `tag list` lands.
Example fix
// before
core::repository::tag::list(repo, &mut out, OutputFormat::Json)?;
// after
let tags: Vec<_> = repo.references()?.tags()?.collect::<Result<_, _>>()?;
for r in tags { writeln!(out, "{}", r.name().as_bstr())?; } Defensive patterns
Strategy: validation
Validate before calling
if format != OutputFormat::Human { // fall back or error before calling list }
let format = if supports_json_tag_list { requested } else { OutputFormat::Human }; Type guard
fn is_human(f: OutputFormat) -> bool { matches!(f, OutputFormat::Human) } Try / catch
match tag::list(&repo, &mut out, format) { Err(e) if e.to_string().contains("JSON output isn't supported") => tag::list(&repo, &mut out, OutputFormat::Human), other => other } Prevention
- Default to OutputFormat::Human unless the subcommand is verified to support JSON.
- Centralize format selection per subcommand capability in your tooling.
- Check subcommand help/docs for supported --format values before scripting.
When it happens
Trigger: Calling `tag::list(repo, out, OutputFormat::Json)` (or any non-Human variant) directly, or running a CLI invocation like `gix tag list --format json`, since the function immediately bails on non-Human formats.
Common situations: Developers scripting gitoxide CLI output expecting machine-readable JSON like other subcommands provide; tooling that uniformly passes a JSON format flag across many subcommands; callers upgrading gitoxide and assuming tag listing gained JSON support.
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
- Only human output format is supported at the moment
- JSON output isn't implemented yet
- Cannot print information using 'human' format.
- JSON output isn't supported
- Only 'human' format is currently supported
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/15501b05d219016a.
Report an issue: GitHub.
Appendix: source
Thrown at gitoxide-core/src/repository/tag.rs:48
let parts = version
.chunk_by(|a, b| a.is_ascii_digit() == b.is_ascii_digit())
.map(|part| {
if let Ok(part) = part.to_str() {
part.parse::<usize>()
.map_or_else(|_| VersionPart::String(part.into()), VersionPart::Number)
} else {
VersionPart::String(part.into())
}
})
.collect();
Self { parts }
}
}
pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write, format: OutputFormat) -> anyhow::Result<()> {
if format != OutputFormat::Human {
anyhow::bail!("JSON output isn't supported");
}
let platform = repo.references()?;
let mut tags: Vec<_> = platform
.tags()?
.flatten()
.map(|mut reference| {
let tag = reference.peel_to_tag();
let tag_ref = tag.as_ref().map(gix::Tag::decode);
// `name` is the name of the file in `refs/tags/`.
// This applies to both lightweight and annotated tags.
let name = reference.name().shorten();
let mut fields = Vec::new();
let version = Version::parse(name);
match tag_ref {
Ok(Ok(tag_ref)) => {View on GitHub (pinned to e73179060b)