nodejs/node · warning

corrupt input [%s]

Error message

corrupt input [%s]

What it means

Printed by DecompressFile at brotli.c:1291 as a final check after successful decompression (BROTLI_DECODER_RESULT_SUCCESS with no extra input). If comment_state is not COMMENT_OK — meaning the metadata comment was started (COMMENT_INIT) but never fully validated — the tool prints this warning. Critically, unlike errors 720/722/725, the function still returns BROTLI_TRUE (success) at line 1297. The decompressed output is produced; only the comment validation is incomplete.

Source

Thrown at deps/brotli/c/tools/brotli.c:1291

          s = context->decoder;
        } else {
          fprintf(stderr, "corrupt input [%s]\n",
                  PrintablePath(context->current_input_path));
          if (context->verbosity > 0) {
            fprintf(stderr, "reason: extra input\n");
          }
          return BROTLI_FALSE;
        }
      } else {
        if (context->verbosity > 0) {
          context->end_time = clock();
          fprintf(stderr, "Decompressed ");
          PrintFileProcessingProgress(context);
          fprintf(stderr, "\n");
        }
        /* Final check */
        if (context->comment_state != COMMENT_OK) {
          fprintf(stderr, "corrupt input [%s]\n",
                  PrintablePath(context->current_input_path));
          if (context->verbosity > 0) {
            fprintf(stderr, "reason: comment mismatch\n");
          }
        }
        return BROTLI_TRUE;
      }
    } else {  /* result == BROTLI_DECODER_RESULT_ERROR */
      fprintf(stderr, "corrupt input [%s]\n",
              PrintablePath(context->current_input_path));
      if (context->verbosity > 0) {
        BrotliDecoderErrorCode error = BrotliDecoderGetErrorCode(s);
        const char* error_str = PrettyDecoderErrorString(error);
        fprintf(stderr, "reason: %s (%d)\n", error_str, error);
      }
      return BROTLI_FALSE;
    }

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Recognize that decompression succeeded (BROTLI_TRUE returned) — the output is valid even though the comment check failed.
  2. If metadata integrity matters, re-compress with a correct comment block from the original encoder.
  3. If metadata is irrelevant, suppress the warning by running without -v or ignoring the stderr message.
  4. Audit the encoder's metadata callback implementation to ensure it always sends exactly comment_len bytes.

Example fix

// The output file is valid despite the warning.
// This returns BROTLI_TRUE, so the decompressed data is usable.
// To silence: run without -v, or fix the encoder's metadata handling.
Defensive patterns

Strategy: validation

Validate before calling

// This is a post-decode warning; decompression itself succeeded (BROTLI_TRUE).
// The output is valid. To validate metadata integrity separately,
// check comment_state == COMMENT_OK after DecompressFile returns.

Try / catch

// DecompressFile returns BROTLI_TRUE even with this warning
BROTLI_BOOL ok = DecompressFile(context);
if (ok && context->comment_state != COMMENT_OK) {
    // Decompression succeeded but comment metadata is incomplete
    // output is still valid; log a warning if metadata integrity matters
}

Prevention

When it happens

Trigger: A brotli stream with a non-zero comment_len decoded successfully to the end, but the metadata callbacks never advanced comment_state through to COMMENT_OK (e.g., the metadata chunk arrived but comment_pos never reached comment_len, leaving the state at COMMENT_INIT). This is a post-decode warning, not a decode failure.

Common situations: A .br file with metadata that was partially stripped or modified after encoding. The compressed payload is intact and decompresses correctly, but the comment/metadata block is incomplete. This is the least severe of the 'corrupt input' messages since decompression itself succeeded.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/175df107e386fa8f. Report an issue: GitHub.