zed-industries/zed · warning

--languages and/or --extensions is required (use --list to s

Error message

--languages and/or --extensions is required (use --list to see available languages, or --stats to see input distribution)

What it means

CLI usage error from the filter_languages subcommand of edit_prediction_cli. The command filters captured examples by language and needs to know which ones to keep; without a selection it refuses to run rather than doing something surprising (like passing everything through). --list (show known languages) and --stats (show input distribution) are the two modes that do not require a selection.

Source

Thrown at crates/edit_prediction_cli/src/filter_languages.rs:262

            println!("  {}: {}", lang, extensions.join(", "));
        }
        return Ok(());
    }

    let input_path: Option<&Path> = match inputs.first().map(|p| p.as_path()) {
        Some(p) if p.as_os_str() == "-" => None,
        Some(p) => Some(p),
        None => None,
    };

    if args.stats {
        let stats_input =
            input_path.with_context(|| "input file is required for --stats (cannot use stdin)")?;
        return run_stats(stats_input, &extension_map);
    }

    if args.languages.is_none() && args.extensions.is_none() {
        bail!(
            "--languages and/or --extensions is required (use --list to see available languages, or --stats to see input distribution)"
        );
    }

    let allowed_languages: std::collections::HashSet<String> = args
        .languages
        .as_ref()
        .map(|langs| langs.iter().map(|l| l.to_lowercase()).collect())
        .unwrap_or_default();

    let allowed_extensions: std::collections::HashSet<String> = args
        .extensions
        .as_ref()
        .map(|exts| {
            exts.iter()
                .map(|e| e.trim_start_matches('.').to_lowercase())
                .collect()
        })

View on GitHub (pinned to f4178619ac)

Solutions

  1. Pass --languages with one or more names, e.g. --languages rust python (case-insensitive)
  2. Or pass --extensions, e.g. --extensions rs py
  3. Run with --list to see available language names, or --stats <input> to inspect the distribution before deciding

Example fix

# before
filter-languages input.jsonl

# after
filter-languages input.jsonl --languages rust
# or
filter-languages --list
Defensive patterns

Strategy: validation

Validate before calling

let has_selection = args.languages.is_some() || args.extensions.is_some();
if !has_selection && !args.stats && !args.list {
    anyhow::bail!("nothing to do: pass --languages/--extensions, or use --list/--stats");
}

Prevention

When it happens

Trigger: Running the filter_languages binary/subcommand with neither --languages nor --extensions set, and without --stats or --list. Input may come from a file argument or stdin ('-'), but no filter selection was supplied.

Common situations: First use of the tool: the user assumes it infers languages from the input; shell scripts where the --languages flag value was an empty/unset variable that expanded to nothing; wanting to just inspect the data but forgetting --stats.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/73d2202053d156dd. Report an issue: GitHub.