{"record":{"id":"3788d5f3b3ce282f","repo":"nodejs/node","slug":"s-error-command-line-argument-java-package-or","errorCode":null,"errorMessage":"%s error: command line argument --java-package or --bundle-name without --write-java\\n","messagePattern":"(.+?) error: command line argument --java-package or --bundle-name without --write-java\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/genrb.cpp","lineNumber":181,"sourceCode":"    }\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' &&\n                  (options[WRITE_POOL_BUNDLE].doesOccur || options[USE_POOL_BUNDLE].doesOccur)\n        ) {\n            fprintf(stderr, \"%s: cannot combine --formatVersion 1 with --writePoolBundle or --usePoolBundle\\n\", argv[0]);\n            illegalArg = true;\n        } else {\n            setFormatVersion(s[0] - '0');\n        }\n    }\n\n    if((options[JAVA_PACKAGE].doesOccur || options[BUNDLE_NAME].doesOccur) &&\n            !options[WRITE_JAVA].doesOccur) {\n        fprintf(stderr,\n                \"%s error: command line argument --java-package or --bundle-name \"\n                \"without --write-java\\n\",\n                argv[0]);\n        illegalArg = true;\n    }\n\n    if(options[VERSION].doesOccur) {\n        fprintf(stderr,\n                \"%s version %s (ICU version %s).\\n\"\n                \"%s\\n\",\n                argv[0], GENRB_VERSION, U_ICU_VERSION, U_COPYRIGHT_STRING);\n        if(!illegalArg) {\n            return U_ZERO_ERROR;\n        }\n    }\n\n    if(illegalArg || options[HELP1].doesOccur || options[HELP2].doesOccur) {\n        /*","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/genrb.cpp#L163-L199","documentation":"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.","triggerScenarios":"Calling `genrb --java-package com.example.i18n root.txt` or `genrb --bundle-name MyElements root.txt` without `-j`/`--write-java`.","commonSituations":"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.","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."],"exampleFix":"// before\ngenrb --java-package com.example.i18n root.txt\n// after\ngenrb --write-java --java-package com.example.i18n root.txt","handlingStrategy":"validation","validationCode":"java_pkg=\"${JAVA_PACKAGE:-}\"\nbundle_name=\"${BUNDLE_NAME:-}\"\nif [ -n \"$java_pkg\" ] || [ -n \"$bundle_name\" ]; then\n  if [ -z \"$WRITE_JAVA\" ]; then\n    echo \"ERROR: --java-package/--bundle-name require --write-java\" >&2\n    exit 2\n  fi\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Group all Java-output flags behind a single WRITE_JAVA variable in your build script so they are emitted together."],"tags":["icu","genrb","cli-argument","java-output"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}