nodejs/node · error

error in command line argument "%s"\n

Error message

error in command line argument "%s"\n

What it means

genccode uses ICU's u_parseArgs to process its option vector. u_parseArgs returns a negative value when it encounters an unrecognized or malformed argument; genccode echoes that offending argument via argv[-argc]. This is the catch-all for any CLI that u_parseArgs could not match against the registered options.

Source

Thrown at deps/icu-small/source/tools/genccode/genccode.c:114

#define CALL_WRITECCODE     'c'
#define CALL_WRITEASSEMBLY  'a'
#define CALL_WRITEOBJECT    'o'
extern int
main(int argc, char* argv[]) {
    UBool verbose = true;
    char writeCode;

    U_MAIN_INIT_ARGS(argc, argv);

    options[kOptDestDir].value = ".";

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

    /* error handling, printing usage message */
    if(argc<0) {
        fprintf(stderr,
            "error in command line argument \"%s\"\n",
            argv[-argc]);
    }
    if(argc<0 || options[kOptHelpH].doesOccur || options[kOptHelpQuestionMark].doesOccur) {
        fprintf(stderr,
            "usage: %s [-options] filename1 filename2 ...\n"
            "\tread each binary input file and \n"
            "\tcreate a .c file with a byte array that contains the input file's data\n"
            "options:\n"
            "\t-h or -? or --help  this usage text\n"
            "\t-d or --destdir     destination directory, followed by the path\n"
            "\t-q or --quiet       do not display warnings and progress\n"
            "\t-n or --name        symbol prefix, followed by the prefix\n"
            "\t-e or --entrypoint  entry point name, followed by the name (_dat will be appended)\n"
            "\t-r or --revision    Specify a version\n"
            , argv[0]);
#ifdef CAN_GENERATE_OBJECTS
        fprintf(stderr,

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run genccode -h to see the supported options for this build and correct the offending token shown in the message.
  2. Check the build script (Makefile/CMake/GN) for typos in the genccode invocation.
  3. Confirm the option exists in your ICU version — some flags (e.g. -o/--object, -c/--cpu-arch) are only compiled in when CAN_GENERATE_OBJECTS is defined.
Defensive patterns

Strategy: validation

Validate before calling

// validate the genccode argv against the known option spec before exec
valid = {'-h','-?','--help','-d','--destdir','-q','--quiet','-n','--name','-e','--entrypoint','-f','--filename','-a','--assembly'}
bad = [a for a in argv[1:] if a.startswith('-') and a not in valid]
if bad: raise SystemExit(f'unknown genccode option(s): {bad}')

Prevention

When it happens

Trigger: Passing an unknown flag (e.g. --foo), a flag that requires an argument but is given none, a value the parser rejects, or a malformed short-option cluster. argv[-argc] indexes the exact token at fault.

Common situations: Typo'd flag name in a Makefile/CMake rule; using a newer/older genccode option against a build script written for a different ICU version; quoting mistake that fuses two options into one token; copying a command from docs for a different tool.

Related errors


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