{"record":{"id":"175df107e386fa8f","repo":"nodejs/node","slug":"corrupt-input-s","errorCode":null,"errorMessage":"corrupt input [%s]\n","messagePattern":"corrupt input \\[(.+?)\\]\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":1291,"sourceCode":"          s = context->decoder;\n        } else {\n          fprintf(stderr, \"corrupt input [%s]\\n\",\n                  PrintablePath(context->current_input_path));\n          if (context->verbosity > 0) {\n            fprintf(stderr, \"reason: extra input\\n\");\n          }\n          return BROTLI_FALSE;\n        }\n      } else {\n        if (context->verbosity > 0) {\n          context->end_time = clock();\n          fprintf(stderr, \"Decompressed \");\n          PrintFileProcessingProgress(context);\n          fprintf(stderr, \"\\n\");\n        }\n        /* Final check */\n        if (context->comment_state != COMMENT_OK) {\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        }\n        return BROTLI_TRUE;\n      }\n    } else {  /* result == BROTLI_DECODER_RESULT_ERROR */\n      fprintf(stderr, \"corrupt input [%s]\\n\",\n              PrintablePath(context->current_input_path));\n      if (context->verbosity > 0) {\n        BrotliDecoderErrorCode error = BrotliDecoderGetErrorCode(s);\n        const char* error_str = PrettyDecoderErrorString(error);\n        fprintf(stderr, \"reason: %s (%d)\\n\", error_str, error);\n      }\n      return BROTLI_FALSE;\n    }\n","sourceCodeStart":1273,"sourceCodeEnd":1309,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L1273-L1309","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Recognize that decompression succeeded (BROTLI_TRUE returned) — the output is valid even though the comment check failed.","If metadata integrity matters, re-compress with a correct comment block from the original encoder.","If metadata is irrelevant, suppress the warning by running without -v or ignoring the stderr message.","Audit the encoder's metadata callback implementation to ensure it always sends exactly comment_len bytes."],"exampleFix":"// The output file is valid despite the warning.\n// This returns BROTLI_TRUE, so the decompressed data is usable.\n// To silence: run without -v, or fix the encoder's metadata handling.","handlingStrategy":"validation","validationCode":"// This is a post-decode warning; decompression itself succeeded (BROTLI_TRUE).\n// The output is valid. To validate metadata integrity separately,\n// check comment_state == COMMENT_OK after DecompressFile returns.","typeGuard":null,"tryCatchPattern":"// DecompressFile returns BROTLI_TRUE even with this warning\nBROTLI_BOOL ok = DecompressFile(context);\nif (ok && context->comment_state != COMMENT_OK) {\n    // Decompression succeeded but comment metadata is incomplete\n    // output is still valid; log a warning if metadata integrity matters\n}","preventionTips":["Recognize that this warning does not indicate failed decompression — the output is usable.","If metadata integrity matters, validate comment_state after decompression.","Test encoder metadata callback paths to ensure they always reach COMMENT_OK."],"tags":["brotli","decompression","comment","metadata","warning","post-decode"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}