{"record":{"id":"ed5a71eb4bc9086f","repo":"nodejs/node","slug":"failed-to-read-input-s-s-n","errorCode":null,"errorMessage":"failed to read input [%s]: %s\\n","messagePattern":"failed to read input \\[(.+?)\\]: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":1093,"sourceCode":"  context->total_out = 0;\n  if (context->verbosity > 0) {\n    context->start_time = clock();\n  }\n}\n\n/* This method might give the false-negative result.\n   However, after an empty / incomplete read it should tell the truth. */\nstatic BROTLI_BOOL HasMoreInput(Context* context) {\n  return feof(context->fin) ? BROTLI_FALSE : BROTLI_TRUE;\n}\n\nstatic BROTLI_BOOL ProvideInput(Context* context) {\n  context->available_in =\n      fread(context->input, 1, kFileBufferSize, context->fin);\n  context->total_in += context->available_in;\n  context->next_in = context->input;\n  if (ferror(context->fin)) {\n    fprintf(stderr, \"failed to read input [%s]: %s\\n\",\n            PrintablePath(context->current_input_path), strerror(errno));\n    return BROTLI_FALSE;\n  }\n  return BROTLI_TRUE;\n}\n\n/* Internal: should be used only in Provide-/Flush-Output. */\nstatic BROTLI_BOOL WriteOutput(Context* context) {\n  size_t out_size = (size_t)(context->next_out - context->output);\n  context->total_out += out_size;\n  if (out_size == 0) return BROTLI_TRUE;\n  if (context->test_integrity) return BROTLI_TRUE;\n\n  fwrite(context->output, 1, out_size, context->fout);\n  if (ferror(context->fout)) {\n    fprintf(stderr, \"failed to write output [%s]: %s\\n\",\n            PrintablePath(context->current_output_path), strerror(errno));\n    return BROTLI_FALSE;","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L1075-L1111","documentation":"After `fread` to fill the input buffer, `ferror(context->fin)` is set, indicating a read error occurred mid-stream. The operation aborts immediately. The message includes the input path and the errno description. This fires on every chunk read, so it can occur partway through a large file.","triggerScenarios":"Physical disk read error (EIO); NFS read timeout or server disconnect; file truncated by another process during reading; reading from a pipe whose writer closed early; I/O error on a degraded RAID array.","commonSituations":"Processing a file on a failing disk; concurrent truncation of the input file by another process; reading from stdin via a pipe where the upstream process crashed; NFS mount instability.","solutions":["Verify the input file integrity and accessibility: `dd if=input of=/dev/null bs=1M`.","If reading from a pipe, ensure the upstream process stays alive for the full duration.","Copy the file to a healthy local filesystem and retry.","Check `dmesg` for hardware/driver-level I/O errors."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"#include <unistd.h>\n#include <stdbool.h>\n\nbool input_file_intact(const char *path) {\n    // Best-effort: verify read access and that file is not a broken symlink\n    if (access(path, R_OK) != 0) return false;\n    return true;\n}\n\n// For ongoing integrity, compute a checksum before and after processing.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy large input files to local storage before processing to avoid mid-stream network errors.","Ensure no other process truncates or modifies the input during compression.","Check `dmesg` for disk I/O errors if read errors recur on the same file."],"tags":["io","read-error","brotli"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}