microsoft/edit · error

unrecognized arguments: {:?}

Error message

unrecognized arguments: {:?}

What it means

After parsing known flags and the free input path, main calls args.finish() and fails if any unconsumed arguments remain. unicode-gen accepts a strict argument set; extra positional or unknown flags are rejected wholesale.

Source

Thrown at crates/unicode-gen/src/main.rs:276

        eprint!("{HELP}");
        return Ok(());
    }

    let mut out = Output {
        arg_lang: args.value_from_fn("--lang", |arg| match arg {
            "c" => Ok(Language::C),
            "rust" => Ok(Language::Rust),
            l => bail!("invalid language: \"{}\"", l),
        })?,
        arg_extended: args.contains("--extended"),
        arg_no_ambiguous: args.contains("--no-ambiguous"),
        arg_line_breaks: args.contains("--line-breaks"),
        ..Default::default()
    };
    let arg_input = args.free_from_os_str(|s| -> Result<PathBuf, &'static str> { Ok(s.into()) })?;
    let arg_remaining = args.finish();
    if !arg_remaining.is_empty() {
        bail!("unrecognized arguments: {:?}", arg_remaining);
    }

    let input = std::fs::read_to_string(arg_input)?;
    let doc = roxmltree::Document::parse(&input)?;
    out.ucd = extract_values_from_ucd(&doc, &out)?;

    // Find the best trie configuration over the given block sizes (2^2 - 2^8) and stages (4).
    // More stages = Less size. The trajectory roughly follows a+b*c^stages, where c < 1.
    // 4 still gives ~30% savings over 3 stages and going beyond 5 gives diminishing returns (<10%).
    out.trie = build_best_trie(&out.ucd.values, 2, 8, 4);

    // The joinRules above has 2 bits per value. This packs it into 32-bit integers to save space.
    out.rules_gc = JOIN_RULES_GRAPHEME_CLUSTER
        .iter()
        .map(|t| {
            let rules_gc_len = if out.arg_extended { t.len() } else { 16 };
            t[..rules_gc_len].iter().map(|row| prepare_rules_row(row, 2, 3)).collect()
        })

View on GitHub (pinned to 826b4c097b)

Solutions

  1. Remove the extra arguments; supply exactly one input file and only the supported flags (--lang, --extended, --no-ambiguous, --line-breaks).
  2. Check for flag typos — an unrecognized flag name will land in the remaining set.
  3. Consult the source (crates/unicode-gen/src/main.rs Output parsing) for the exact accepted flag list.

Example fix

// before
unicode-gen --lang=c --extended extra.txt GraphemeBreakProperty.txt
// after
unicode-gen --lang=c --extended GraphemeBreakProperty.txt
Defensive patterns

Strategy: validation

Validate before calling

// enforce exact argc before invoking
let ucd_files: Vec<_> = std::env::args().skip(1).filter(|a| !a.starts_with("--")).collect();
if ucd_files.len() != 1 { eprintln!("expected exactly one UCD input file"); std::process::exit(2); }

Prevention

When it happens

Trigger: Passing extra positional arguments (e.g. multiple UCD files when only one is accepted) or unknown flags like --verbose / -o out; also leftover arguments from a mistyped flag name (e.g. --langage which is not consumed).

Common situations: Copy-pasting command lines from other tools; passing output-file arguments that this generator does not support; typos in supported flags leaving both the typo and intended behavior unresolved.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of microsoft/edit@826b4c097b (2026-09-06). Data as JSON: /api/errors/17fcab1f70dfefdf. Report an issue: GitHub.