GitoxideLabs/gitoxide · error
JSON output isn't supported
Error message
JSON output isn't supported
What it means
The branch `list` command supports only human-readable output; a non-Human OutputFormat (e.g. JSON) bails before enumerating references. JSON serialization for branch listing is not implemented in gitoxide-core.
Solutions
- Use the human output format and parse the text
- Enumerate branches via the gix library (`repo.references()?` / remote refs) and serialize to JSON yourself
- File or track an upstream feature request for JSON branch output
Example fix
// before branch::list(repo, &mut out, OutputFormat::Json, options)?; // after branch::list(repo, &mut out, OutputFormat::Human, options)?;
Defensive patterns
Strategy: validation
Validate before calling
if format != OutputFormat::Human {
eprintln!("branch list: JSON not supported; using Human");
format = OutputFormat::Human;
} Try / catch
match branch::list(repo, out, format, options) {
Err(e) if e.to_string().contains("JSON output isn't supported") => {
// fall back to human output or use gix library refs API
}
other => other?,
} Prevention
- Use Human output for branch listing
- Enumerate branches via gix::Repository references API for structured data
- Check format support per subcommand before invoking with JSON
When it happens
Trigger: Calling `repository::branch::list` with `format != OutputFormat::Human`, e.g. the CLI branch listing invoked with a JSON format flag.
Common situations: Scripts or tools expecting machine-readable branch listings from gix; IDE integrations requesting JSON output uniformly.
Related errors
- JSON output isn't supported
- JSON output isn't implemented yet
- JSON output isn't implemented yet
- Only 'human' format is currently supported
- JSON output isn't supported
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/5fabb05dfb97e343.
Report an issue: GitHub.
Appendix: source
Thrown at gitoxide-core/src/repository/branch.rs:21
pub mod list {
pub enum Kind {
Local,
All,
}
pub struct Options {
pub kind: Kind,
}
}
pub fn list(
repo: gix::Repository,
out: &mut dyn std::io::Write,
format: OutputFormat,
options: list::Options,
) -> anyhow::Result<()> {
if format != OutputFormat::Human {
anyhow::bail!("JSON output isn't supported");
}
let platform = repo.references()?;
let (show_local, show_remotes) = match options.kind {
list::Kind::Local => (true, false),
list::Kind::All => (true, true),
};
if show_local {
let mut branch_names: Vec<String> = platform
.local_branches()?
.flatten()
.map(|branch| branch.name().shorten().to_string())
.collect();
branch_names.sort();
View on GitHub (pinned to e73179060b)