nodejs/node · error

%s: error in command line argument "%s"\n

Error message

%s: error in command line argument "%s"\n

What it means

genrb (resource-bundle compiler) parses options with u_parseArgs. A negative return signals an unrecognized or malformed argument; genrb records the offending token (argv[-argc]) and sets the illegalArg flag rather than exiting immediately, so it can accumulate multiple errors before printing usage.

Source

Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:151

{
    UErrorCode  status    = U_ZERO_ERROR;
    const char *arg       = nullptr;
    const char *outputDir = nullptr; /* nullptr = no output directory, use current */
    const char *inputDir  = nullptr;
    const char *filterDir = nullptr;
    const char *encoding  = "";
    int         i;
    UBool illegalArg = false;

    U_MAIN_INIT_ARGS(argc, argv);

    options[JAVA_PACKAGE].value = "com.ibm.icu.impl.data";
    options[BUNDLE_NAME].value = "LocaleElements";
    argc = u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);

    /* error handling, printing usage message */
    if(argc<0) {
        fprintf(stderr, "%s: error in command line argument \"%s\"\n", argv[0], argv[-argc]);
        illegalArg = true;
    } else if(argc<2) {
        illegalArg = true;
    }
    if(options[WRITE_POOL_BUNDLE].doesOccur && options[USE_POOL_BUNDLE].doesOccur) {
        fprintf(stderr, "%s: cannot combine --writePoolBundle and --usePoolBundle\n", argv[0]);
        illegalArg = true;
    }
    if (options[ICU4X_MODE].doesOccur && !options[UCADATA].doesOccur) {
        fprintf(stderr, "%s: --icu4xMode requires --ucadata\n", argv[0]);
        illegalArg = true;
    }
    if(options[FORMAT_VERSION].doesOccur) {
        const char *s = options[FORMAT_VERSION].value;
        if(uprv_strlen(s) != 1 || (s[0] < '1' || '3' < s[0])) {
            fprintf(stderr, "%s: unsupported --formatVersion %s\n", argv[0], s);
            illegalArg = true;
        } else if(s[0] == '1' &&

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run `genrb -h` for this build's option set and fix the offending token shown in the message.
  2. Ensure every value-taking option is immediately followed by its argument.
  3. Align your build script with the ICU version actually installed; some options (e.g. --writePoolBundle, --icu4xMode, --ucadata) exist only in newer genrb.
Defensive patterns

Strategy: validation

Validate before calling

// validate genrb flags against a version-aware allowlist
import subprocess
help_txt = subprocess.run(['genrb','-h'],capture_output=True,text=True).stdout
# parse allowed long options from help, then diff against your argv

Prevention

When it happens

Trigger: Any unrecognized flag, a value-taking flag missing its value, or otherwise malformed CLI. Because genrb defers the exit, you may see this alongside the more specific messages (758, 759, formatVersion errors) before the final usage banner and non-zero exit.

Common situations: Typo'd long option in a packaging script; using an option from a different ICU version (genrb's option set changes across releases); a missing argument after -s/-d/-e/-i in an automated build.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/5c7ea2754242b004. Report an issue: GitHub.