{"record":{"id":"366d6e62ed84f698","repo":"apache/druid","slug":"unexpected-marker-type-d","errorCode":null,"errorMessage":"Unexpected marker type[%d]","messagePattern":"Unexpected marker type\\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/frame/channel/ReadableByteChunksFrameChannel.java","lineNumber":391,"sourceCode":"    final byte[] decompressedBytes =\n        FrameCompression.decompress(compressedMemory, 0, compressedMemory.getCapacity());\n\n    switch (markerType) {\n      case FrameFileWriter.MARKER_FRAME:\n        final Frame frame = Frame.wrap(decompressedBytes);\n        log.debug(\"Read frame with rows[%,d] and bytes[%,d].\", frame.numRows(), frame.numBytes());\n        return frame.asRAC();\n\n      case FrameFileWriter.MARKER_RAC:\n        if (wtContext == null) {\n          throw DruidException.defensive(\"Cannot read RAC, no WireTransferableContext\");\n        }\n        final RowsAndColumns rac = wtContext.deserialize(ByteBufferUtils.wrapLE(decompressedBytes));\n        log.debug(\"Read RAC with rows[%,d] and bytes[%,d].\", rac.numRows(), decompressedBytes.length);\n        return rac;\n\n      default:\n        throw new ISE(\"Unexpected marker type[%d]\", markerType);\n    }\n  }\n\n  @GuardedBy(\"lock\")\n  private void updateStreamState()\n  {\n    if (streamPart == StreamPart.MAGIC) {\n      if (bytesBuffered >= FrameFileWriter.MAGIC.length) {\n        final Memory memory = copyFromQueuedChunks(FrameFileWriter.MAGIC.length);\n\n        if (memory.equalTo(0, Memory.wrap(FrameFileWriter.MAGIC), 0, FrameFileWriter.MAGIC.length)) {\n          streamPart = StreamPart.FRAMES;\n          deleteFromQueuedChunks(FrameFileWriter.MAGIC.length);\n        } else {\n          throw new ISE(\"Invalid stream header (id = %s, position = %d)\", id, bytesAdded - bytesBuffered);\n        }\n      }\n    }","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/frame/channel/ReadableByteChunksFrameChannel.java#L373-L409","documentation":"After the stream header, each frame begins with a marker byte (frame data or no-more-frames). The switch over nextMarkerType hit a value the deserializer does not understand, so the reader throws. This means stream state desynchronized or the marker byte was corrupted.","triggerScenarios":"markerType read from the stream is neither MARKER_FRAME nor MARKER_NO_MORE_FRAMES (the switch default) when decoding a frame in nextRAC.","commonSituations":"Corrupted frame file or transport; reading a stream whose format differs between writer and reader versions; earlier decoding bug shifted the byte position.","solutions":["Regenerate the frame data (rerun the stage/query) to rule out transient corruption.","Confirm writer and reader use the same Druid version/frame format.","Check disk/filesystem health where frame files are spooled.","Report the marker byte value and channel id with logs if persistent."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { rac = channel.read(); } catch (ISE e) { if (e.getMessage().startsWith(\"Unexpected marker type\")) { failStage(\"stream desync/corruption\", e); } else { throw e; } }","preventionTips":["Ensure exactly one producer and one consumer per channel.","Verify matching Druid versions across writer and reader.","Monitor storage health for spool directories."],"tags":["druid","frame-channel","corruption"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}