{"record":{"id":"19755bd32fe79071","repo":"nodejs/node","slug":"s-error-don-t-specify-an-encoding-e-when-wri","errorCode":null,"errorMessage":"%s: Error: don't specify an encoding (-e) when writing to stdout (-c).\\n","messagePattern":"(.+?): Error: don't specify an encoding \\(-e\\) when writing to stdout \\(-c\\)\\.\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/derb.cpp","lineNumber":136,"sourceCode":"            \" bundle ...\\n\", argc < 0 ? 'u' : 'U',\n            pname);\n        return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;\n    }\n\n    if(options[10].doesOccur) {\n        fprintf(stderr,\n                \"%s version %s (ICU version %s).\\n\"\n                \"%s\\n\",\n                pname, DERB_VERSION, U_ICU_VERSION, U_COPYRIGHT_STRING);\n        return U_ZERO_ERROR;\n    }\n    if(options[2].doesOccur) {\n        encoding = options[2].value;\n    }\n\n    if (options[3].doesOccur) {\n      if(options[2].doesOccur) {\n        fprintf(stderr, \"%s: Error: don't specify an encoding (-e) when writing to stdout (-c).\\n\", pname);\n        return 3;\n      }\n      tostdout = 1;\n    }\n\n    if(options[4].doesOccur) {\n        opt_truncate = true;\n        if(options[4].value != nullptr) {\n            truncsize = atoi(options[4].value); /* user defined printable size */\n        } else {\n            truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */\n        }\n    } else {\n        opt_truncate = false;\n    }\n\n    if(options[5].doesOccur) {\n        verbose = true;","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/derb.cpp#L118-L154","documentation":"derb treats -c/--to-stdout and -e/--encoding as mutually exclusive: writing raw bytes to stdout is incompatible with a user-specified output encoding. If both doesOccur, it prints this error and returns 3 before doing any work.","triggerScenarios":"options[3] (to-stdout, -c) and options[2] (encoding, -e) are both present on the command line. derb detects the combination and aborts.","commonSituations":"Piping derb output through another tool (-c) while also trying to force a specific encoding (-e); copy-pasting a genrb command line that included -e and adding -c; shell alias that always sets -e.","solutions":["Drop -e when using -c (let derb write the native/raw bytes to stdout).","Or drop -c and write to a file (-d destdir) so -e can control the encoding of that file.","If you need a specific encoding on stdout, encode the bundle to a file with -e and then `cat`/transcode that file separately."],"exampleFix":"# before\nderb -c -e UTF-8 root.res\n\n# after\nderb -c root.res          # raw bytes to stdout\n# or\nderb -e UTF-8 -d out root.res   # encoded file, no stdout","handlingStrategy":"validation","validationCode":"// enforce mutual exclusion of -c and -e\nif '-c' in argv and ('-e' in argv or '--encoding' in argv):\n    raise SystemExit('derb: -c/--to-stdout and -e/--encoding are mutually exclusive')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When scripting derb to stdout, never set -e.","Document the encoding choice in a comment so future editors don't re-add -e."],"tags":["icu","derb","genrb","cli","mutually-exclusive"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}