GitoxideLabs/gitoxide · error

JSON output isn't implemented yet

Error message

JSON output isn't implemented yet

What it means

The `gix clean` command refuses to produce machine-readable output. `clean` implements only the Human output format; as soon as a non-Human `OutputFormat` (JSON) is requested it aborts with `bail!` before doing any work. This is an explicit unimplemented-feature guard, not a runtime failure.

Solutions

  1. Use `OutputFormat::Human` (or omit the format flag) until JSON support lands for `clean`
  2. Check the gitoxide changelog/releases for when `clean` gains JSON output and upgrade
  3. Parse human output as an interim workaround, or use `gix status`/directory walk APIs directly in a custom tool

Example fix

// before
clean(repo, options, OutputFormat::Json, progress, &mut out)?;
// after
clean(repo, options, OutputFormat::Human, progress, &mut out)?;
Defensive patterns

Strategy: validation

Validate before calling

if format != gix::output_format::OutputFormat::Human {
    anyhow::bail!("gix clean supports only human output");
}

Prevention

When it happens

Trigger: Calling `gitoxide_core::repository::clean::clean` (or running `gix clean --format json`) with `format: OutputFormat::Json` or any format other than `Human`.

Common situations: Scripting the clean command expecting structured output; an agent/CI pipeline passing a uniform `--format json` flag across subcommands; copying an options struct from another subcommand that does support JSON.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/966b448cf9388805. Report an issue: GitHub.

Appendix: source

Thrown at gitoxide-core/src/repository/clean.rs:60

        repo: gix::Repository,
        out: &mut dyn std::io::Write,
        err: &mut dyn std::io::Write,
        patterns: Vec<BString>,
        Options {
            debug,
            format,
            mut execute,
            ignored,
            precious,
            directories,
            repositories,
            skip_hidden_repositories,
            find_untracked_repositories,
            pathspec_matches_result,
        }: Options,
    ) -> anyhow::Result<()> {
        if format != OutputFormat::Human {
            bail!("JSON output isn't implemented yet");
        }
        let Some(workdir) = repo.workdir() else {
            bail!("Need a worktree to clean, this is a bare repository");
        };

        let index = repo.index_or_empty()?;
        let pathspec_for_dirwalk = !pathspec_matches_result;
        let has_patterns = !patterns.is_empty();
        let mut collect = InterruptibleCollect::default();
        let collapse_directories = CollapseDirectory;
        let options = repo
            .dirwalk_options()?
            .emit_pruned(true)
            .for_deletion(if (ignored || precious) && directories {
                match skip_hidden_repositories {
                    Some(FindRepository::NonBare) => Some(FindNonBareRepositoriesInIgnoredDirectories),
                    Some(FindRepository::All) => Some(FindRepositoriesInIgnoredDirectories),
                    None => Some(Default::default()),

View on GitHub (pinned to e73179060b)