{"record":{"id":"5c7ea2754242b004","repo":"nodejs/node","slug":"s-error-in-command-line-argument-s-n-5c7ea2","errorCode":null,"errorMessage":"%s: error in command line argument \"%s\"\\n","messagePattern":"(.+?): error in command line argument \"(.+?)\"\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/genrb.cpp","lineNumber":151,"sourceCode":"{\n    UErrorCode  status    = U_ZERO_ERROR;\n    const char *arg       = nullptr;\n    const char *outputDir = nullptr; /* nullptr = no output directory, use current */\n    const char *inputDir  = nullptr;\n    const char *filterDir = nullptr;\n    const char *encoding  = \"\";\n    int         i;\n    UBool illegalArg = false;\n\n    U_MAIN_INIT_ARGS(argc, argv);\n\n    options[JAVA_PACKAGE].value = \"com.ibm.icu.impl.data\";\n    options[BUNDLE_NAME].value = \"LocaleElements\";\n    argc = u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);\n\n    /* error handling, printing usage message */\n    if(argc<0) {\n        fprintf(stderr, \"%s: error in command line argument \\\"%s\\\"\\n\", argv[0], argv[-argc]);\n        illegalArg = true;\n    } else if(argc<2) {\n        illegalArg = true;\n    }\n    if(options[WRITE_POOL_BUNDLE].doesOccur && options[USE_POOL_BUNDLE].doesOccur) {\n        fprintf(stderr, \"%s: cannot combine --writePoolBundle and --usePoolBundle\\n\", argv[0]);\n        illegalArg = true;\n    }\n    if (options[ICU4X_MODE].doesOccur && !options[UCADATA].doesOccur) {\n        fprintf(stderr, \"%s: --icu4xMode requires --ucadata\\n\", argv[0]);\n        illegalArg = true;\n    }\n    if(options[FORMAT_VERSION].doesOccur) {\n        const char *s = options[FORMAT_VERSION].value;\n        if(uprv_strlen(s) != 1 || (s[0] < '1' || '3' < s[0])) {\n            fprintf(stderr, \"%s: unsupported --formatVersion %s\\n\", argv[0], s);\n            illegalArg = true;\n        } else if(s[0] == '1' &&","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/genrb.cpp#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `genrb -h` for this build's option set and fix the offending token shown in the message.","Ensure every value-taking option is immediately followed by its argument.","Align your build script with the ICU version actually installed; some options (e.g. --writePoolBundle, --icu4xMode, --ucadata) exist only in newer genrb."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate genrb flags against a version-aware allowlist\nimport subprocess\nhelp_txt = subprocess.run(['genrb','-h'],capture_output=True,text=True).stdout\n# parse allowed long options from help, then diff against your argv","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After upgrading ICU, re-run your genrb wrapper against -h and update the flag set.","Pass file operands last and quote paths to avoid token-fusion parsing errors."],"tags":["icu","genrb","cli","arg-parse"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}