{"record":{"id":"73d2202053d156dd","repo":"zed-industries/zed","slug":"languages-and-or-extensions-is-required-use","errorCode":null,"errorMessage":"--languages and/or --extensions is required (use --list to see available languages, or --stats to see input distribution)","messagePattern":"--languages and/or --extensions is required \\(use --list to see available languages, or --stats to see input distribution\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/edit_prediction_cli/src/filter_languages.rs","lineNumber":262,"sourceCode":"            println!(\"  {}: {}\", lang, extensions.join(\", \"));\n        }\n        return Ok(());\n    }\n\n    let input_path: Option<&Path> = match inputs.first().map(|p| p.as_path()) {\n        Some(p) if p.as_os_str() == \"-\" => None,\n        Some(p) => Some(p),\n        None => None,\n    };\n\n    if args.stats {\n        let stats_input =\n            input_path.with_context(|| \"input file is required for --stats (cannot use stdin)\")?;\n        return run_stats(stats_input, &extension_map);\n    }\n\n    if args.languages.is_none() && args.extensions.is_none() {\n        bail!(\n            \"--languages and/or --extensions is required (use --list to see available languages, or --stats to see input distribution)\"\n        );\n    }\n\n    let allowed_languages: std::collections::HashSet<String> = args\n        .languages\n        .as_ref()\n        .map(|langs| langs.iter().map(|l| l.to_lowercase()).collect())\n        .unwrap_or_default();\n\n    let allowed_extensions: std::collections::HashSet<String> = args\n        .extensions\n        .as_ref()\n        .map(|exts| {\n            exts.iter()\n                .map(|e| e.trim_start_matches('.').to_lowercase())\n                .collect()\n        })","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/filter_languages.rs#L244-L280","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass --languages with one or more names, e.g. --languages rust python (case-insensitive)","Or pass --extensions, e.g. --extensions rs py","Run with --list to see available language names, or --stats <input> to inspect the distribution before deciding"],"exampleFix":"# before\nfilter-languages input.jsonl\n\n# after\nfilter-languages input.jsonl --languages rust\n# or\nfilter-languages --list","handlingStrategy":"validation","validationCode":"let has_selection = args.languages.is_some() || args.extensions.is_some();\nif !has_selection && !args.stats && !args.list {\n    anyhow::bail!(\"nothing to do: pass --languages/--extensions, or use --list/--stats\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair filter-languages with an explicit --languages or --extensions value","When scripting, fail fast on unset variables: --languages ${LANGS:?must be set}","Use --stats on the input first to see which languages are worth keeping"],"tags":["rust","cli","argument-validation","edit-prediction"],"backgroundTag":"missing-required-argument","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}