{"record":{"id":"582dea9fcd476940","repo":"nodejs/node","slug":"u-illegal-argument-error-582dea","errorCode":"U_ILLEGAL_ARGUMENT_ERROR","errorMessage":"Invalid option for --mode (must be uprops)\n","messagePattern":"Invalid option for --mode \\(must be uprops\\)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/icuexportdata/icuexportdata.cpp","lineNumber":1157,"sourceCode":"            \"\\tdump Unicode property data to .toml files\\n\"\n            \"options:\\n\"\n            \"\\t-h or -? or --help  this usage text\\n\"\n            \"\\t-V or --version     show a version message\\n\"\n            \"\\t-m or --mode        mode: currently only 'uprops', but more may be added\\n\"\n            \"\\t      --trie-type   set the trie type (small or fast, default small)\\n\"\n            \"\\t-d or --destdir     destination directory, followed by the path\\n\"\n            \"\\t      --all         write out all properties known to icuexportdata\\n\"\n            \"\\t      --index       write an _index.toml summarizing all data exported\\n\"\n            \"\\t-c or --copyright   include a copyright notice\\n\"\n            \"\\t-v or --verbose     Turn on verbose output\\n\"\n            \"\\t-q or --quiet       do not display warnings and progress\\n\",\n            argv[0]);\n        return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;\n    }\n\n    const char* mode = options[OPT_MODE].value;\n    if (uprv_strcmp(mode, \"uprops\") != 0) {\n        fprintf(stderr, \"Invalid option for --mode (must be uprops)\\n\");\n        return U_ILLEGAL_ARGUMENT_ERROR;\n    }\n\n    if (options[OPT_TRIE_TYPE].doesOccur) {\n        if (uprv_strcmp(options[OPT_TRIE_TYPE].value, \"fast\") == 0) {\n            trieType = UCPTRIE_TYPE_FAST;\n        } else if (uprv_strcmp(options[OPT_TRIE_TYPE].value, \"small\") == 0) {\n            trieType = UCPTRIE_TYPE_SMALL;\n        } else {\n            fprintf(stderr, \"Invalid option for --trie-type (must be small or fast)\\n\");\n            return U_ILLEGAL_ARGUMENT_ERROR;\n        }\n    }\n\n    for (const char* propName : propNames) {\n        UProperty propEnum = u_getPropertyEnum(propName);\n        if (propEnum == UCHAR_INVALID_CODE) {\n            std::cerr << \"Error: Invalid property alias: \" << propName << std::endl;","sourceCodeStart":1139,"sourceCodeEnd":1175,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/icuexportdata/icuexportdata.cpp#L1139-L1175","documentation":"icuexportdata validates its --mode option and only accepts the value 'uprops' (Unicode property data export). Any other value for --mode produces U_ILLEGAL_ARGUMENT_ERROR. This tool has been narrowed to a single export mode; the check is a strict string comparison against 'uprops'. The tool returns the error code without exiting, so the calling process can handle it.","triggerScenarios":"Passing --mode with any value other than 'uprops' (e.g. --mode uprops2, --mode coll, --mode break, or a typo). The option parser stores the value and this check rejects it. Unlike genrb errors that call exit(), this returns U_ILLEGAL_ARGUMENT_ERROR to the main function for normal process exit handling.","commonSituations":"Following outdated documentation or tutorials that reference modes no longer supported; typo in the mode value; copy-pasting a command from a script written for a different ICU version that had additional modes; habitually specifying --mode even though 'uprops' is the only option.","solutions":["Use --mode uprops (the only supported value): `icuexportdata --mode uprops -d output/`","Omit the --mode option entirely if the default is uprops","Check the tool's help output for current valid options: `icuexportdata --help`","Update any scripts or documentation that reference deprecated mode values"],"exampleFix":"// before: invalid mode\nicuexportdata --mode coll -d output/\n// after: valid mode\nicuexportdata --mode uprops -d output/\n// or simply omit --mode\nicuexportdata -d output/","handlingStrategy":"validation","validationCode":"# Validate icuexportdata mode before running\nMODE=\"uprops\"\n[ \"$MODE\" = \"uprops\" ] || { echo \"ERROR: --mode must be 'uprops', got '$MODE'\"; exit 1; }\n# Or check in a wrapper script\nvalidate_mode() {\n    case \"$1\" in\n        uprops) return 0 ;;\n        *) echo \"Invalid mode: '$1'. Only 'uprops' is supported.\"; return 1 ;;\n    esac\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use --mode uprops (the only supported value) or omit --mode entirely","Check icuexportdata --help for current valid options","Update scripts and documentation when upgrading ICU versions to reflect current CLI options","Validate CLI arguments in wrapper scripts before invoking the tool"],"tags":["icu","icuexportdata","argument-error","cli","mode"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}