{"record":{"id":"4b40c72a6e35bed5","repo":"GitoxideLabs/gitoxide","slug":"only-human-output-format-is-supported-at-the-momen-4b40c7","errorCode":null,"errorMessage":"Only human output format is supported at the moment","messagePattern":"Only human output format is supported at the moment","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/tree.rs","lineNumber":159,"sourceCode":"    #[cfg(feature = \"serde\")]\n    {\n        delegate.stats.bytes = extended.then_some(delegate.stats.num_bytes);\n        serde_json::to_writer_pretty(out, &delegate.stats)?;\n    }\n\n    Ok(())\n}\n\npub fn entries(\n    repo: gix::Repository,\n    treeish: Option<&str>,\n    recursive: bool,\n    extended: bool,\n    format: OutputFormat,\n    mut out: impl io::Write,\n) -> anyhow::Result<()> {\n    if format != OutputFormat::Human {\n        bail!(\"Only human output format is supported at the moment\");\n    }\n\n    let tree = treeish_to_tree(treeish, &repo)?;\n\n    if recursive {\n        let mut write = BufWriter::new(out);\n        let mut delegate = entries::Traverse::new(extended.then_some(&repo), Some(&mut write));\n        tree.traverse().depthfirst(&mut delegate)?;\n    } else {\n        for entry in tree.iter() {\n            let entry = entry?;\n            format_entry(\n                &mut out,\n                &entry.inner,\n                entry.inner.filename,\n                extended.then(|| entry.id().header().map(|o| o.size())).transpose()?,\n            )?;\n        }","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/tree.rs#L141-L177","documentation":"`gitoxide_core::repository::tree::entries` only implements human-readable rendering of tree contents. Any `OutputFormat` other than `Human` is rejected with `bail!` before resolving the treeish, so callers cannot request JSON output for tree listings. It is a deliberate feature-gate, not a runtime failure.","triggerScenarios":"Calling `entries(...)` with `format: OutputFormat::Json` (or another non-Human value), or running the CLI tree command with a JSON format flag (e.g. `gix tree entries --format json <treeish>`).","commonSituations":"Scripting `gix tree` output for pipelines; tooling that passes a uniform `--format json` flag to all subcommands; migrating from `git ls-tree` JSON wrappers expecting parity.","solutions":["Use the default human format (omit `--format` or pass human).","Call the underlying `gix` tree-traversal APIs yourself and emit your own JSON.","Pipe through a converter that parses the human tree listing.","Track upstream gitoxide for JSON tree output support."],"exampleFix":"// before\nentries(&repo, treeish, recursive, extended, OutputFormat::Json, out)?;\n// after\nlet tree = treeish_to_tree(treeish, &repo)?;\nfor entry in tree.entries()? { /* serialize entry yourself */ }","handlingStrategy":"validation","validationCode":"if format != OutputFormat::Human { format = OutputFormat::Human; // tree entries has no JSON yet }","typeGuard":"fn json_supported_tree_entries(f: &OutputFormat) -> bool { matches!(f, OutputFormat::Human) }","tryCatchPattern":"if let Err(e) = entries(&repo, treeish, rec, ext, format, &mut out) { if e.to_string().contains(\"Only human output format\") { entries(&repo, treeish, rec, ext, OutputFormat::Human, &mut out)? } else { return Err(e.into()) } }","preventionTips":["Omit --format for `gix tree` invocations in scripts.","Build your own JSON serialization on top of gix tree APIs if JSON is required.","Keep a capability map of which gitoxide subcommands support which formats."],"tags":["cli","json","output-format","git","tree"],"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"}