nodejs/node · error

1

1

Error message

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

What it means

pkgdata's u_parseArgs returned a negative argc, meaning an unrecognized or malformed argument; the offending token is argv[-argc]. pkgdata prints it and returns exit code 1. Fires before any of the -O/-p/input-file checks.

Source

Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:300

    U_MAIN_INIT_ARGS(argc, argv);

    progname = argv[0];

    options[MODE].value = "common";

    /* read command line options */
    argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);

    /* error handling, printing usage message */
    /* I've decided to simply print an error and quit. This tool has too
    many options to just display them all of the time. */

    if(options[HELP].doesOccur || options[HELP_QUESTION_MARK].doesOccur) {
        needsHelp = true;
    }
    else {
        if(!needsHelp && argc<0) {
            fprintf(stderr,
                "%s: error in command line argument \"%s\"\n",
                progname,
                argv[-argc]);
            fprintf(stderr, "Run '%s --help' for help.\n", progname);
            return 1;
        }


#if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
        if(!options[BLDOPT].doesOccur && uprv_strcmp(options[MODE].value, "common") != 0) {
          if (pkg_getPkgDataPath(options[VERBOSE].doesOccur, &options[BLDOPT]) != 0) {
                fprintf(stderr, " required parameter is missing: -O is required for static and shared builds.\n");
                fprintf(stderr, "Run '%s --help' for help.\n", progname);
                return 1;
            }
        }
#else
        if(options[BLDOPT].doesOccur) {

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Inspect the printed token — it is the exact argument u_parseArgs rejected.
  2. Run `pkgdata --help` to see the valid option set for this build.
  3. Quote shell arguments to prevent glob/word-splitting.

Example fix

# before
pkgdata --modd common
# after
pkgdata --mode common
Defensive patterns

Strategy: validation

Validate before calling

# bash: validate the option set your script uses before calling
pkgdata --help >/dev/null 2>&1 || { echo "pkgdata missing"; exit 2; }
# quote all args; reject unquoted globs in the wrapper

Try / catch

# log stderr so the offending token is captured
err="$(pkgdata "$@" 2>&1 >/dev/null)" || { echo "pkgdata: $err" >&2; exit 1; }

Prevention

When it happens

Trigger: Unknown flag (e.g. `--modd`), a flag missing its value, or malformed option syntax.

Common situations: Typo in an option name; version skew (flag renamed/removed across ICU versions); unquoted shell glob producing unexpected tokens.

Related errors


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