{"record":{"id":"f6bece0b4f0225d5","repo":"apache/druid","slug":"unexpected-end-of-field","errorCode":null,"errorMessage":"Unexpected end of field","messagePattern":"Unexpected end of field","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/frame/field/StringFieldReader.java","lineNumber":604,"sourceCode":"\n              final ByteBuffer buf = FrameReaderUtils.readByteBuffer(memory, position, len);\n              list.add(buf);\n\n              position += len;\n\n              break;\n            }\n          }\n\n          break;\n\n        default:\n          throw new ISE(\"Invalid value start byte [%s]\", kind);\n      }\n    }\n\n    if (!rowTerminatorSeen) {\n      throw new ISE(\"Unexpected end of field\");\n    }\n    return isEffectivelyNull;\n  }\n}\n","sourceCodeStart":586,"sourceCodeEnd":609,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/frame/field/StringFieldReader.java#L586-L609","documentation":"addStringsToList expects to eventually read the row terminator byte marking the end of the field. If the loop consumes all values without seeing a terminator, the field is truncated relative to its expected layout and \"Unexpected end of field\" is thrown. Like the overrun check, it protects against corrupt or misaligned frame data.","triggerScenarios":"Decoding a string field where the declared field region ends (values loop exits) without a ROW_TERMINATOR byte — truncated frames, wrong length passed in, or offset pointing into the middle of a field.","commonSituations":"Frames sliced/paginated incorrectly before deserialization; reading a frame at a stale or partial offset (e.g. from durable storage that was truncated); version skew in frame serialization.","solutions":["Re-run the query or re-read the frame from source to replace the truncated data.","Validate frame offsets/lengths when slicing frame partitions before reading fields.","Match reader/writer Druid versions and frame format."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  reader.readStringsFromMemory(memory, position, limit, list);\n} catch (IllegalStateException e) {\n  if (e.getMessage().equals(\"Unexpected end of field\")) {\n    throw new CorruptFrameException(\"Truncated frame field; re-fetch frame\", e);\n  }\n  throw e;\n}","preventionTips":["Validate partition offsets and lengths when slicing frame files before reading.","Ensure writers fully flush frames before readers open them."],"tags":["frame-corruption","string-field","truncated-data","druid"],"backgroundTag":"internal-invariant-violation","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"}