{"record":{"id":"d71c0b9cc0a3f9fb","repo":"nodejs/node","slug":"u-illegal-argument-error-d71c0b","errorCode":"U_ILLEGAL_ARGUMENT_ERROR","errorMessage":"icupkg: --auto_toc_prefix_with_type and also --toc_prefix\n","messagePattern":"icupkg: --auto_toc_prefix_with_type and also --toc_prefix\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/icupkg/icupkg.cpp","lineNumber":299,"sourceCode":"        printUsage(pname, true);\n        return U_ZERO_ERROR;\n    }\n\n    pkg=new Package;\n    if(pkg==nullptr) {\n        fprintf(stderr, \"icupkg: not enough memory\\n\");\n        return U_MEMORY_ALLOCATION_ERROR;\n    }\n    isModified=false;\n\n    int autoPrefix=0;\n    if(options[OPT_AUTO_TOC_PREFIX].doesOccur) {\n        pkg->setAutoPrefix();\n        ++autoPrefix;\n    }\n    if(options[OPT_AUTO_TOC_PREFIX_WITH_TYPE].doesOccur) {\n        if(options[OPT_TOC_PREFIX].doesOccur) {\n            fprintf(stderr, \"icupkg: --auto_toc_prefix_with_type and also --toc_prefix\\n\");\n            printUsage(pname, false);\n            return U_ILLEGAL_ARGUMENT_ERROR;\n        }\n        pkg->setAutoPrefixWithType();\n        ++autoPrefix;\n    }\n    if(argc<2 || 3<argc || autoPrefix>1) {\n        printUsage(pname, false);\n        return U_ILLEGAL_ARGUMENT_ERROR;\n    }\n\n    if(options[OPT_SOURCEDIR].doesOccur) {\n        sourcePath=options[OPT_SOURCEDIR].value;\n    } else {\n        // work relative to the current working directory\n        sourcePath=nullptr;\n    }\n    if(options[OPT_DESTDIR].doesOccur) {","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/icupkg/icupkg.cpp#L281-L317","documentation":"`--auto_toc_prefix_with_type` derives the TOC prefix automatically from each item's type; supplying `--toc_prefix` at the same time is contradictory. icupkg detects both flags set, prints the conflict, shows usage, and returns U_ILLEGAL_ARGUMENT_ERROR.","triggerScenarios":"Passing both `--auto_toc_prefix_with_type` and `--toc_prefix <prefix>` in one invocation.","commonSituations":"Build scripts that prepend a default flag block then append an explicit prefix; copy-pasted commands from different recipes.","solutions":["Use exactly one of `--auto_toc_prefix_with_type` or `--toc_prefix`.","Let auto-prefixing derive the value, or supply it explicitly — not both."],"exampleFix":"# before\nicupkg --auto_toc_prefix_with_type --toc_prefix my in.dat\n# after\nicupkg --toc_prefix my in.dat","handlingStrategy":"validation","validationCode":"# bash: the two flags are mutually exclusive\nif [ -n \"$TOC_PREFIX\" ] && [ \"$AUTO_TOC_WITH_TYPE\" = 1 ]; then\n  echo \"--toc_prefix and --auto_toc_prefix_with_type are mutually exclusive\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model the prefix-source as an enum (auto|auto_typed|explicit) in your script, not three independent booleans."],"tags":["icu","icupkg","cli","arguments"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}