{"record":{"id":"92f68ec35b2d0d60","repo":"GitoxideLabs/gitoxide","slug":"json-output-isn-t-implemented-yet-92f68e","errorCode":null,"errorMessage":"JSON output isn't implemented yet","messagePattern":"JSON output isn't implemented yet","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/dirty.rs","lineNumber":17,"sourceCode":"use anyhow::bail;\n\nuse crate::OutputFormat;\n\npub enum Mode {\n    IsClean,\n    IsDirty,\n}\n\npub fn check(\n    repo: gix::Repository,\n    mode: Mode,\n    out: &mut dyn std::io::Write,\n    format: OutputFormat,\n) -> anyhow::Result<()> {\n    if format != OutputFormat::Human {\n        bail!(\"JSON output isn't implemented yet\");\n    }\n    let is_dirty = repo.is_dirty()?;\n    let res = match (is_dirty, mode) {\n        (false, Mode::IsClean) => Ok(\"The repository is clean\"),\n        (true, Mode::IsClean) => Err(\"The repository has changes\"),\n        (false, Mode::IsDirty) => Err(\"The repository is clean\"),\n        (true, Mode::IsDirty) => Ok(\"The repository has changes\"),\n    };\n\n    let suffix = \"(not counting untracked files)\";\n    match res {\n        Ok(msg) => writeln!(out, \"{msg} {suffix}\")?,\n        Err(msg) => bail!(\"{msg} {suffix}\"),\n    }\n    Ok(())\n}\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/dirty.rs#L1-L34","documentation":"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.","triggerScenarios":"Calling `check` in gitoxide-core/src/repository/dirty.rs with `format: OutputFormat::Json` — i.e. running `gix status dirty --format json` or equivalent.","commonSituations":"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.","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"],"exampleFix":"// before\ncheck(repo, mode, out, OutputFormat::Json)?;\n// after\ncheck(repo, mode, out, OutputFormat::Human)?;","handlingStrategy":"validation","validationCode":"if format != OutputFormat::Human {\n    eprintln!(\"dirty check only supports human output\");\n    format = OutputFormat::Human;\n}","typeGuard":"fn supports_json_output(cmd: &str) -> bool {\n    !matches!(cmd, \"dirty\" | \"dirwalk\" | \"exclude\" | \"fetch\")\n}","tryCatchPattern":"match dirty::check(repo, mode, &mut out, format) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"JSON output\") => {\n        dirty::check(repo, mode, &mut out, OutputFormat::Human)?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["cli","json","not-implemented"],"backgroundTag":"method-not-implemented","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}