nodejs/node · info
reason: comment mismatch\n
Error message
reason: comment mismatch\n
What it means
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.
Source
Thrown at deps/brotli/c/tools/brotli.c:1235
static BROTLI_BOOL DecompressFile(Context* context) {
BrotliDecoderState* s = context->decoder;
BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
if (context->comment_len) {
context->comment_state = COMMENT_INIT;
BrotliDecoderSetMetadataCallbacks(s, &OnMetadataStart, &OnMetadataChunk,
(void*)context);
} else {
context->comment_state = COMMENT_OK;
}
InitializeBuffers(context);
for (;;) {
/* Early check */
if (context->comment_state == COMMENT_BAD) {
fprintf(stderr, "corrupt input [%s]\n",
PrintablePath(context->current_input_path));
if (context->verbosity > 0) {
fprintf(stderr, "reason: comment mismatch\n");
}
return BROTLI_FALSE;
}
if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
if (!HasMoreInput(context)) {
fprintf(stderr, "corrupt input [%s]\n",
PrintablePath(context->current_input_path));
if (context->verbosity > 0) {
fprintf(stderr, "reason: truncated input\n");
}
return BROTLI_FALSE;
}
if (!ProvideInput(context)) return BROTLI_FALSE;
} else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
if (!ProvideOutput(context)) return BROTLI_FALSE;
} else if (result == BROTLI_DECODER_RESULT_SUCCESS) {
if (!FlushOutput(context)) return BROTLI_FALSE;
BROTLI_BOOL has_more_input = (context->available_in != 0);View on GitHub (pinned to 1b2de5e052)
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.
Defensive patterns
Strategy: validation
Validate before calling
// This is a verbose diagnostic; run without -v to suppress. // To validate metadata before decompression, inspect the stream header // with the brotli streaming API and check comment_len consistency.
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/7bf5209467eee6cc.
Report an issue: GitHub.