nodejs/node · error
U_ILLEGAL_ARGUMENT_ERROR
U_ILLEGAL_ARGUMENT_ERROR
Error message
Invalid option for --mode (must be uprops)
What it means
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.
Source
Thrown at deps/icu-small/source/tools/icuexportdata/icuexportdata.cpp:1157
"\tdump Unicode property data to .toml files\n"
"options:\n"
"\t-h or -? or --help this usage text\n"
"\t-V or --version show a version message\n"
"\t-m or --mode mode: currently only 'uprops', but more may be added\n"
"\t --trie-type set the trie type (small or fast, default small)\n"
"\t-d or --destdir destination directory, followed by the path\n"
"\t --all write out all properties known to icuexportdata\n"
"\t --index write an _index.toml summarizing all data exported\n"
"\t-c or --copyright include a copyright notice\n"
"\t-v or --verbose Turn on verbose output\n"
"\t-q or --quiet do not display warnings and progress\n",
argv[0]);
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
}
const char* mode = options[OPT_MODE].value;
if (uprv_strcmp(mode, "uprops") != 0) {
fprintf(stderr, "Invalid option for --mode (must be uprops)\n");
return U_ILLEGAL_ARGUMENT_ERROR;
}
if (options[OPT_TRIE_TYPE].doesOccur) {
if (uprv_strcmp(options[OPT_TRIE_TYPE].value, "fast") == 0) {
trieType = UCPTRIE_TYPE_FAST;
} else if (uprv_strcmp(options[OPT_TRIE_TYPE].value, "small") == 0) {
trieType = UCPTRIE_TYPE_SMALL;
} else {
fprintf(stderr, "Invalid option for --trie-type (must be small or fast)\n");
return U_ILLEGAL_ARGUMENT_ERROR;
}
}
for (const char* propName : propNames) {
UProperty propEnum = u_getPropertyEnum(propName);
if (propEnum == UCHAR_INVALID_CODE) {
std::cerr << "Error: Invalid property alias: " << propName << std::endl;View on GitHub (pinned to 1b2de5e052)
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
Example fix
// before: invalid mode icuexportdata --mode coll -d output/ // after: valid mode icuexportdata --mode uprops -d output/ // or simply omit --mode icuexportdata -d output/
Defensive patterns
Strategy: validation
Validate before calling
# Validate icuexportdata mode before running
MODE="uprops"
[ "$MODE" = "uprops" ] || { echo "ERROR: --mode must be 'uprops', got '$MODE'"; exit 1; }
# Or check in a wrapper script
validate_mode() {
case "$1" in
uprops) return 0 ;;
*) echo "Invalid mode: '$1'. Only 'uprops' is supported."; return 1 ;;
esac
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- command already set when parsing -d
- command already set when parsing -t\n
- error in command line argument "%s"\n
- error in command line argument "%s"\n
- %s: error in command line argument "%s"\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/582dea9fcd476940.
Report an issue: GitHub.