{"record":{"id":"9281fd1b619b9aa2","repo":"apache/hadoop","slug":"unknown-op-in-data-stream","errorCode":null,"errorMessage":"Unknown op {} in data stream","messagePattern":"Unknown op (.+?) in data stream","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/Receiver.java","lineNumber":137,"sourceCode":"      opBlockChecksum(in);\n      break;\n    case BLOCK_GROUP_CHECKSUM:\n      opStripedBlockChecksum(in);\n      break;\n    case TRANSFER_BLOCK:\n      opTransferBlock(in);\n      break;\n    case REQUEST_SHORT_CIRCUIT_FDS:\n      opRequestShortCircuitFds(in);\n      break;\n    case RELEASE_SHORT_CIRCUIT_FDS:\n      opReleaseShortCircuitFds(in);\n      break;\n    case REQUEST_SHORT_CIRCUIT_SHM:\n      opRequestShortCircuitShm(in);\n      break;\n    default:\n      throw new IOException(\"Unknown op \" + op + \" in data stream\");\n    }\n  }\n\n  static private CachingStrategy getCachingStrategy(CachingStrategyProto strategy) {\n    Boolean dropBehind = strategy.hasDropBehind() ?\n        strategy.getDropBehind() : null;\n    Long readahead = strategy.hasReadahead() ?\n        strategy.getReadahead() : null;\n    return new CachingStrategy(dropBehind, readahead);\n  }\n\n  /** Receive OP_READ_BLOCK */\n  private void opReadBlock() throws IOException {\n    OpReadBlockProto proto = OpReadBlockProto.parseFrom(vintPrefixed(in));\n    TraceScope traceScope = continueTraceSpan(proto.getHeader(),\n        proto.getClass().getSimpleName());\n    try {\n      readBlock(PBHelperClient.convert(proto.getHeader().getBaseHeader().getBlock()),","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/Receiver.java#L119-L155","documentation":"Receiver.processOp switches over the op code parsed off the data-transfer stream; any op value outside the handled set (READ_BLOCK, WRITE_BLOCK, block transfer, short-circuit ops, etc.) hits the default branch and throws IOException 'Unknown op N in data stream'.","triggerScenarios":"A newer-version peer sends an operation this DataNode does not implement; or the stream desynchronizes (partial read, corrupted framing) so subsequent bytes decode to an invalid op code.","commonSituations":"Rolling upgrade with a new block operation reaching an old DN; custom clients with framing bugs; connection/stream corruption after network or TLS faults; fuzzed input on the xfer port.","solutions":["Check for version skew between the sender and this DataNode; upgrade the DN to a version that understands the op","If versions match, suspect stream corruption: capture the op value from DN logs and inspect the connection (MTU/TLS/keepalive issues)","For custom clients, restrict yourself to ops the target DataTransferProtocol implements"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  receiver.processOp(in);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Unknown op\")) {\n    // unsupported or desynchronized op stream: close the connection; log the op\n    // code and peer for diagnosis rather than continuing on the same stream\n  } else {\n    throw e;\n  }\n}","preventionTips":["Keep DFSClient/DN versions compatible; check DN logs for the op value and peer address on first occurrence","For custom clients, unit-test framing against the target DataTransferProtocol op set"],"tags":["hdfs","datatransfer","op-code","datanode","protocol","corruption"],"backgroundTag":"unknown-opcode","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}