nodejs/node · error
%s error: command line argument --java-package or --bundle-n
Error message
%s error: command line argument --java-package or --bundle-name without --write-java\n
What it means
The --java-package and --bundle-name flags only configure Java ListResourceBundle output, so genrb requires --write-java to also be present. The check at genrb.cpp:179-186 sets illegalArg=true if either JAVA_PACKAGE or BUNDLE_NAME occurs while WRITE_JAVA does not. Without --write-java these flags have no effect and almost always indicate a copy-paste or script bug.
Source
Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:181
}
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;
}
if(options[VERSION].doesOccur) {
fprintf(stderr,
"%s version %s (ICU version %s).\n"
"%s\n",
argv[0], GENRB_VERSION, U_ICU_VERSION, U_COPYRIGHT_STRING);
if(!illegalArg) {
return U_ZERO_ERROR;
}
}
if(illegalArg || options[HELP1].doesOccur || options[HELP2].doesOccur) {
/*View on GitHub (pinned to 1b2de5e052)
Solutions
- Add --write-java (optionally followed by an output encoding): `genrb --write-java --java-package com.example.i18n root.txt`.
- If Java output was not intended, remove the --java-package / --bundle-name flags entirely.
Example fix
// before genrb --java-package com.example.i18n root.txt // after genrb --write-java --java-package com.example.i18n root.txt
Defensive patterns
Strategy: validation
Validate before calling
java_pkg="${JAVA_PACKAGE:-}"
bundle_name="${BUNDLE_NAME:-}"
if [ -n "$java_pkg" ] || [ -n "$bundle_name" ]; then
if [ -z "$WRITE_JAVA" ]; then
echo "ERROR: --java-package/--bundle-name require --write-java" >&2
exit 2
fi
fi Prevention
- Group all Java-output flags behind a single WRITE_JAVA variable in your build script so they are emitted together.
When it happens
Trigger: Calling `genrb --java-package com.example.i18n root.txt` or `genrb --bundle-name MyElements root.txt` without `-j`/`--write-java`.
Common situations: A build script that conditionally adds --java-package based on a variable but unconditionally forgets --write-java; migrating a Java-output pipeline and dropping the -j line.
Related errors
- %s: unsupported --formatVersion %s\n
- %s: cannot combine --formatVersion 1 with --writePoolBundle
- %s: error in command line argument "%s"\n
- %s: Error: don't specify an encoding (-e) when writing to st
- %s: error in command line argument "%s"\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/3788d5f3b3ce282f.
Report an issue: GitHub.