GitoxideLabs/gitoxide · error · anyhow::Error
JSON output isn't implemented yet
Error message
JSON output isn't implemented yet
What it means
The `dirty` check command supports two output formats, but only the human-readable format is implemented. Passing `OutputFormat::Json` (e.g. `--format json` on the CLI) throws this error because JSON serialization of the dirtiness result was never added.
Solutions
- Use the default human format (omit `--format` or pass `human`)
- Parse the human-readable output if automation is needed (fragile; prefer waiting for JSON support)
- Implement or upvote JSON output support in the dirty subcommand
Example fix
// before check(repo, mode, out, OutputFormat::Json)?; // after check(repo, mode, out, OutputFormat::Human)?;
Defensive patterns
Strategy: validation
Validate before calling
if format != OutputFormat::Human {
eprintln!("dirty check only supports human output");
format = OutputFormat::Human;
} Type guard
fn supports_json_output(cmd: &str) -> bool {
!matches!(cmd, "dirty" | "dirwalk" | "exclude" | "fetch")
} Try / catch
match dirty::check(repo, mode, &mut out, format) {
Ok(()) => (),
Err(e) if e.to_string().contains("JSON output") => {
dirty::check(repo, mode, &mut out, OutputFormat::Human)?;
}
Err(e) => return Err(e),
} Prevention
- Only pass --format json to subcommands documented as supporting it
- Check subcommand help output for supported formats
- Default to OutputFormat::Human unless JSON is confirmed available
When it happens
Trigger: Calling `check` in gitoxide-core/src/repository/dirty.rs with `format: OutputFormat::Json` — i.e. running `gix status dirty --format json` or equivalent.
Common situations: CI scripts or tooling that expects machine-readable output for the dirty check; developers who habitually pass `--format json` because other gix subcommands support it.
Related errors
- JSON output isn't yet supported for listing ref-mappings.
- Only human output is currently supported
- Only human format is supported right now
- Only human output is supported for now
- JSON output isn't supported
AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08).
Data as JSON: /api/errors/92f68ec35b2d0d60.
Report an issue: GitHub.
Appendix: source
Thrown at gitoxide-core/src/repository/dirty.rs:17
use anyhow::bail;
use crate::OutputFormat;
pub enum Mode {
IsClean,
IsDirty,
}
pub fn check(
repo: gix::Repository,
mode: Mode,
out: &mut dyn std::io::Write,
format: OutputFormat,
) -> anyhow::Result<()> {
if format != OutputFormat::Human {
bail!("JSON output isn't implemented yet");
}
let is_dirty = repo.is_dirty()?;
let res = match (is_dirty, mode) {
(false, Mode::IsClean) => Ok("The repository is clean"),
(true, Mode::IsClean) => Err("The repository has changes"),
(false, Mode::IsDirty) => Err("The repository is clean"),
(true, Mode::IsDirty) => Ok("The repository has changes"),
};
let suffix = "(not counting untracked files)";
match res {
Ok(msg) => writeln!(out, "{msg} {suffix}")?,
Err(msg) => bail!("{msg} {suffix}"),
}
Ok(())
}
View on GitHub (pinned to e73179060b)