{"record":{"id":"7bf5209467eee6cc","repo":"nodejs/node","slug":"reason-comment-mismatch-n","errorCode":null,"errorMessage":"reason: comment mismatch\\n","messagePattern":"reason: comment mismatch\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":1235,"sourceCode":"static BROTLI_BOOL DecompressFile(Context* context) {\n  BrotliDecoderState* s = context->decoder;\n  BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;\n  if (context->comment_len) {\n    context->comment_state = COMMENT_INIT;\n    BrotliDecoderSetMetadataCallbacks(s, &OnMetadataStart, &OnMetadataChunk,\n        (void*)context);\n  } else {\n    context->comment_state = COMMENT_OK;\n  }\n\n  InitializeBuffers(context);\n  for (;;) {\n    /* Early check */\n    if (context->comment_state == COMMENT_BAD) {\n      fprintf(stderr, \"corrupt input [%s]\\n\",\n              PrintablePath(context->current_input_path));\n      if (context->verbosity > 0) {\n        fprintf(stderr, \"reason: comment mismatch\\n\");\n      }\n      return BROTLI_FALSE;\n    }\n    if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {\n      if (!HasMoreInput(context)) {\n        fprintf(stderr, \"corrupt input [%s]\\n\",\n                PrintablePath(context->current_input_path));\n        if (context->verbosity > 0) {\n          fprintf(stderr, \"reason: truncated input\\n\");\n        }\n        return BROTLI_FALSE;\n      }\n      if (!ProvideInput(context)) return BROTLI_FALSE;\n    } else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {\n      if (!ProvideOutput(context)) return BROTLI_FALSE;\n    } else if (result == BROTLI_DECODER_RESULT_SUCCESS) {\n      if (!FlushOutput(context)) return BROTLI_FALSE;\n      BROTLI_BOOL has_more_input = (context->available_in != 0);","sourceCodeStart":1217,"sourceCodeEnd":1253,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L1217-L1253","documentation":"Verbose diagnostic printed at brotli.c:1235 only when verbosity > 0, immediately after the 'corrupt input' message at line 1232. It confirms that the abort was caused specifically by a metadata comment mismatch (comment_state == COMMENT_BAD), distinguishing it from truncated-input or decoder-error causes. It is informational — the actual failure return happens at line 1237.","triggerScenarios":"Same as error 720: the OnMetadataChunk callback detected that received metadata bytes do not match the declared comment_len, setting comment_state to COMMENT_BAD. This message appears only when the user passed -v (verbosity > 0) to the brotli decompressor.","commonSituations":"A developer debugging a corrupt brotli file runs 'brotli -d -v file.br' to get the detailed reason. The comment block in the brotli stream was written incorrectly by a custom or older encoder, or the file was modified after compression.","solutions":["Confirm the root cause is comment metadata by checking this message appears alongside the 'corrupt input' line.","Re-generate the .br file from the original uncompressed source using a current brotli encoder.","If you only care about the decompressed payload and not the metadata, strip or ignore the metadata section in the encoder before recompression.","Validate the stream with the brotli streaming API to isolate whether the corruption is in the metadata header or the compressed data blocks."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// This is a verbose diagnostic; run without -v to suppress.\n// To validate metadata before decompression, inspect the stream header\n// with the brotli streaming API and check comment_len consistency.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use -v only when actively debugging to reduce noise.","When writing brotli encoders, ensure metadata callbacks emit exactly comment_len bytes.","Test round-trip compression/decompression in CI to catch metadata mismatches early."],"tags":["brotli","decompression","verbose","metadata","diagnostic"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}