{"record":{"id":"15501b05d219016a","repo":"GitoxideLabs/gitoxide","slug":"json-output-isn-t-supported-15501b","errorCode":null,"errorMessage":"JSON output isn't supported","messagePattern":"JSON output isn't supported","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/tag.rs","lineNumber":48,"sourceCode":"        let parts = version\n            .chunk_by(|a, b| a.is_ascii_digit() == b.is_ascii_digit())\n            .map(|part| {\n                if let Ok(part) = part.to_str() {\n                    part.parse::<usize>()\n                        .map_or_else(|_| VersionPart::String(part.into()), VersionPart::Number)\n                } else {\n                    VersionPart::String(part.into())\n                }\n            })\n            .collect();\n\n        Self { parts }\n    }\n}\n\npub fn list(repo: gix::Repository, out: &mut dyn std::io::Write, format: OutputFormat) -> anyhow::Result<()> {\n    if format != OutputFormat::Human {\n        anyhow::bail!(\"JSON output isn't supported\");\n    }\n\n    let platform = repo.references()?;\n\n    let mut tags: Vec<_> = platform\n        .tags()?\n        .flatten()\n        .map(|mut reference| {\n            let tag = reference.peel_to_tag();\n            let tag_ref = tag.as_ref().map(gix::Tag::decode);\n\n            // `name` is the name of the file in `refs/tags/`.\n            // This applies to both lightweight and annotated tags.\n            let name = reference.name().shorten();\n            let mut fields = Vec::new();\n            let version = Version::parse(name);\n            match tag_ref {\n                Ok(Ok(tag_ref)) => {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/tag.rs#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ncore::repository::tag::list(repo, &mut out, OutputFormat::Json)?;\n// after\nlet tags: Vec<_> = repo.references()?.tags()?.collect::<Result<_, _>>()?;\nfor r in tags { writeln!(out, \"{}\", r.name().as_bstr())?; }","handlingStrategy":"validation","validationCode":"if format != OutputFormat::Human { // fall back or error before calling list }\nlet format = if supports_json_tag_list { requested } else { OutputFormat::Human };","typeGuard":"fn is_human(f: OutputFormat) -> bool { matches!(f, OutputFormat::Human) }","tryCatchPattern":"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 }","preventionTips":["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."],"tags":["cli","json","output-format","git"],"backgroundTag":"unsupported-operation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}