{"record":{"id":"3aec4fb26d23f1d4","repo":"GitoxideLabs/gitoxide","slug":"json-output-isn-t-implemented-yet","errorCode":null,"errorMessage":"JSON output isn't implemented yet","messagePattern":"JSON output isn't implemented yet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/attributes/query.rs","lineNumber":32,"sourceCode":"    use gix::bstr::BStr;\n\n    use crate::{\n        OutputFormat, is_dir_to_mode,\n        repository::{\n            PathsOrPatterns,\n            attributes::query::{Options, attributes_cache},\n        },\n    };\n\n    pub fn query(\n        repo: gix::Repository,\n        input: PathsOrPatterns,\n        mut out: impl io::Write,\n        mut err: impl io::Write,\n        Options { format, statistics }: Options,\n    ) -> anyhow::Result<()> {\n        if format != OutputFormat::Human {\n            bail!(\"JSON output isn't implemented yet\");\n        }\n\n        let (mut cache, index) = attributes_cache(&repo)?;\n        let mut matches = cache.attribute_matches();\n\n        match input {\n            PathsOrPatterns::Paths(paths) => {\n                for path in paths {\n                    let mode = gix::path::from_bstr(Cow::Borrowed(path.as_ref()))\n                        .metadata()\n                        .ok()\n                        .map(|m| is_dir_to_mode(m.is_dir()));\n\n                    let entry = cache.at_entry(&path, mode)?;\n                    if !entry.matching_attributes(&mut matches) {\n                        continue;\n                    }\n                    print_match(&matches, path.as_ref(), &mut out)?;","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/attributes/query.rs#L14-L50","documentation":"The `attributes query` command only implements human-readable output; requesting any other OutputFormat (JSON) bails before executing the query. JSON serialization for attribute queries has not been implemented yet.","triggerScenarios":"Calling `repository::attributes::query` with `format != OutputFormat::Human`, e.g. the CLI `ein tools attributes ... --format json` invocation.","commonSituations":"Tooling that uniformly requests JSON across gix subcommands; scripts parsing attribute query results as JSON.","solutions":["Use the default human output format and parse it","Call the gix library attributes API directly and serialize results yourself","Track or file an upstream issue for JSON support in attribute queries"],"exampleFix":"// before\nlet opts = Options { format: OutputFormat::Json, statistics: None };\nattributes::query(repo, input, out, err, opts)?;\n// after\nlet opts = Options { format: OutputFormat::Human, statistics: None };\nattributes::query(repo, input, out, err, opts)?;","handlingStrategy":"validation","validationCode":"if format != OutputFormat::Human {\n    eprintln!(\"attributes query: JSON not implemented; using Human\");\n    format = OutputFormat::Human;\n}","typeGuard":null,"tryCatchPattern":"match attributes::query(repo, input, out, err, opts) {\n    Err(e) if e.to_string().contains(\"JSON output isn't implemented\") => {\n        // fall back to human output and parse text\n    }\n    other => other?,\n}","preventionTips":["Default to Human format for attributes subcommands","Build JSON from the gix attributes library API instead of CLI output","Check subcommand docs for supported OutputFormat values"],"tags":["cli","json","output-format","unsupported-feature"],"backgroundTag":"operation-not-supported","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"}