nodejs/node · error
%s: unsupported --formatVersion %s\n
Error message
%s: unsupported --formatVersion %s\n
What it means
genrb rejected the value passed to --formatVersion. The argument must be exactly one character and that character must be a digit between '1' and '3' (inclusive). The check uses uprv_strlen(s) != 1 together with the range test s[0] < '1' || '3' < s[0], so empty strings, multi-character strings, letters, '0', and '4'+'9' all fail. The flag merely sets illegalArg=true and does not exit immediately; the program continues argument validation and later prints the full usage text before returning U_ILLEGAL_ARGUMENT_ERROR.
Source
Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:167
/* error handling, printing usage message */
if(argc<0) {
fprintf(stderr, "%s: error in command line argument \"%s\"\n", argv[0], argv[-argc]);
illegalArg = true;
} else if(argc<2) {
illegalArg = true;
}
if(options[WRITE_POOL_BUNDLE].doesOccur && options[USE_POOL_BUNDLE].doesOccur) {
fprintf(stderr, "%s: cannot combine --writePoolBundle and --usePoolBundle\n", argv[0]);
illegalArg = true;
}
if (options[ICU4X_MODE].doesOccur && !options[UCADATA].doesOccur) {
fprintf(stderr, "%s: --icu4xMode requires --ucadata\n", argv[0]);
illegalArg = true;
}
if(options[FORMAT_VERSION].doesOccur) {
const char *s = options[FORMAT_VERSION].value;
if(uprv_strlen(s) != 1 || (s[0] < '1' || '3' < s[0])) {
fprintf(stderr, "%s: unsupported --formatVersion %s\n", argv[0], s);
illegalArg = true;
} else if(s[0] == '1' &&
(options[WRITE_POOL_BUNDLE].doesOccur || options[USE_POOL_BUNDLE].doesOccur)
) {
fprintf(stderr, "%s: cannot combine --formatVersion 1 with --writePoolBundle or --usePoolBundle\n", argv[0]);
illegalArg = true;
} else {
setFormatVersion(s[0] - '0');
}
}
if((options[JAVA_PACKAGE].doesOccur || options[BUNDLE_NAME].doesOccur) &&
!options[WRITE_JAVA].doesOccur) {
fprintf(stderr,
"%s error: command line argument --java-package or --bundle-name "
"without --write-java\n",
argv[0]);
illegalArg = true;View on GitHub (pinned to 1b2de5e052)
Solutions
- Pass a single digit 1, 2, or 3: `genrb --formatVersion 2 root.txt`.
- If you need the newest format, omit --formatVersion entirely so genrb uses its default (currently formatVersion 3).
- Check that the shell variable supplying the value is set and contains exactly one character before invoking genrb.
Example fix
// before genrb --formatVersion 1.0 root.txt // after genrb --formatVersion 1 root.txt
Defensive patterns
Strategy: validation
Validate before calling
# Validate --formatVersion before invoking genrb
fv="${FORMAT_VERSION:-}"
if [ -n "$fv" ] && ! printf '%s' "$fv" | grep -qE '^[1-3]$'; then
echo "ERROR: --formatVersion must be a single digit 1-3, got '$fv'" >&2
exit 2
fi
genrb ${fv:+--formatVersion "$fv"} root.txt Prevention
- Centralize genrb flag construction in one build-script function so formatVersion is validated once.
- Treat an empty FORMAT_VERSION variable as 'use default' rather than passing --formatVersion with no value.
When it happens
Trigger: Invoking genrb with --formatVersion 0, --formatVersion 4, --formatVersion 12, --formatVersion v2, or --formatVersion with no value. Reproduce: `genrb --formatVersion 4 root.txt`. The branch at genrb.cpp:166 fires whenever the value is not a single digit in [1,3].
Common situations: Typing the version with extra characters (e.g. '1.0' or 'v3'), copying a formatVersion from documentation that targets a newer ICU where higher versions exist, or passing the flag through a build variable that resolved to empty. Often seen when scripts interpolate an unbound variable.
Related errors
- %s: cannot combine --formatVersion 1 with --writePoolBundle
- %s error: command line argument --java-package or --bundle-n
- U_INVALID_FORMAT_ERROR
- %s: error in command line argument "%s"\n
- %s: Error: don't specify an encoding (-e) when writing to st
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/cc7ec27409fed1f1.
Report an issue: GitHub.