{"record":{"id":"cc7ec27409fed1f1","repo":"nodejs/node","slug":"s-unsupported-formatversion-s-n","errorCode":null,"errorMessage":"%s: unsupported --formatVersion %s\\n","messagePattern":"(.+?): unsupported --formatVersion (.+?)\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/genrb.cpp","lineNumber":167,"sourceCode":"    /* error handling, printing usage message */\n    if(argc<0) {\n        fprintf(stderr, \"%s: error in command line argument \\\"%s\\\"\\n\", argv[0], argv[-argc]);\n        illegalArg = true;\n    } else if(argc<2) {\n        illegalArg = true;\n    }\n    if(options[WRITE_POOL_BUNDLE].doesOccur && options[USE_POOL_BUNDLE].doesOccur) {\n        fprintf(stderr, \"%s: cannot combine --writePoolBundle and --usePoolBundle\\n\", argv[0]);\n        illegalArg = true;\n    }\n    if (options[ICU4X_MODE].doesOccur && !options[UCADATA].doesOccur) {\n        fprintf(stderr, \"%s: --icu4xMode requires --ucadata\\n\", argv[0]);\n        illegalArg = true;\n    }\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;","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/genrb.cpp#L149-L185","documentation":"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.","triggerScenarios":"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].","commonSituations":"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.","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."],"exampleFix":"// before\ngenrb --formatVersion 1.0 root.txt\n// after\ngenrb --formatVersion 1 root.txt","handlingStrategy":"validation","validationCode":"# Validate --formatVersion before invoking genrb\nfv=\"${FORMAT_VERSION:-}\"\nif [ -n \"$fv\" ] && ! printf '%s' \"$fv\" | grep -qE '^[1-3]$'; then\n  echo \"ERROR: --formatVersion must be a single digit 1-3, got '$fv'\" >&2\n  exit 2\nfi\ngenrb ${fv:+--formatVersion \"$fv\"} root.txt","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["icu","genrb","cli-argument","format-version"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}