{"record":{"id":"580247091d793bf3","repo":"nodejs/node","slug":"write-to-standard-output-already-set","errorCode":null,"errorMessage":"write to standard output already set\n","messagePattern":"write to standard output already set\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":349,"sourceCode":"      continue;\n    }\n\n    /* Simple / coalesced options. */\n    if (arg[1] != '-') {\n      size_t j;\n      for (j = 1; j < arg_len; ++j) {\n        char c = arg[j];\n        if (c >= '0' && c <= '9') {\n          if (quality_set) {\n            fprintf(stderr, \"quality already set\\n\");\n            return COMMAND_INVALID;\n          }\n          quality_set = BROTLI_TRUE;\n          params->quality = c - '0';\n          continue;\n        } else if (c == 'c') {\n          if (output_set) {\n            fprintf(stderr, \"write to standard output already set\\n\");\n            return COMMAND_INVALID;\n          }\n          output_set = BROTLI_TRUE;\n          params->write_to_stdout = BROTLI_TRUE;\n          continue;\n        } else if (c == 'd') {\n          if (command_set) {\n            fprintf(stderr, \"command already set when parsing -d\\n\");\n            return COMMAND_INVALID;\n          }\n          command_set = BROTLI_TRUE;\n          command = COMMAND_DECOMPRESS;\n          continue;\n        } else if (c == 'f') {\n          if (params->force_overwrite) {\n            fprintf(stderr, \"force output overwrite already set\\n\");\n            return COMMAND_INVALID;\n          }","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L331-L367","documentation":"The brotli `-c`/`--stdout` flag directs output to standard output. It may be given only once; a second occurrence is rejected.","triggerScenarios":"Passing `-c` twice, e.g. `brotli -c -c file` or a coalesced `brotli -cc file`.","commonSituations":"An alias that includes `-c` and the user adding `-c` again; a wrapper concatenating flag groups.","solutions":["Remove the duplicate `-c` so it appears once.","Rebuild argv from a de-duplicated set when scripting."],"exampleFix":"// before\nbrotli -c -c file\n// after\nbrotli -c file","handlingStrategy":"validation","validationCode":"assert sum(1 for a in argv if a in ('-c','--stdout') or (a.startswith('-') and not a.startswith('--') and 'c' in a)) <= 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not coalesce duplicate short flags.","Keep `-c` in either the alias or the explicit args, not both."],"tags":["brotli","cli","argument-parsing","output"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}