{"record":{"id":"6735744d93e9f63f","repo":"apache/druid","slug":"exception-encountered-while-serializing-s-in","errorCode":null,"errorMessage":"Exception encountered while serializing [%s] in [%s]","messagePattern":"Exception encountered while serializing \\[(.+?)\\] in \\[(.+?)\\]","errorType":"exception","errorClass":"RE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/FrameBasedInlineDataSourceSerializer.java","lineNumber":77,"sourceCode":"    List<ColumnType> columnTypes = IntStream.range(0, rowSignature.size())\n                                            .mapToObj(i -> rowSignature.getColumnType(i).orElse(null))\n                                            .collect(Collectors.toList());\n    jg.writeObjectField(\"columnTypes\", columnTypes);\n\n    jg.writeArrayFieldStart(\"rows\");\n\n    value.getRowsAsSequence().forEach(row -> {\n      try {\n        JacksonUtils.writeObjectUsingSerializerProvider(jg, serializers, row);\n      }\n      catch (IOException e) {\n        // Ideally, this shouldn't be reachable.\n        // Wrap the IO exception in the runtime exception and propogate it forward\n        List<String> elements = new ArrayList<>();\n        for (Object o : row) {\n          elements.add(o.toString());\n        }\n        throw new RE(\n            e,\n            \"Exception encountered while serializing [%s] in [%s]\",\n            String.join(\", \", elements),\n            FrameBasedInlineDataSource.class\n        );\n      }\n    });\n\n    jg.writeEndArray();\n    jg.writeEndObject();\n  }\n\n  /**\n   * Required because {@link DataSource} is polymorphic\n   */\n  @Override\n  public void serializeWithType(\n      FrameBasedInlineDataSource value,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/FrameBasedInlineDataSourceSerializer.java#L59-L95","documentation":"FrameBasedInlineDataSourceSerializer serializes inline datasource rows into a frame. If an IOException occurs during serialization and it cannot be propagated normally, it is wrapped in this ResourceNoSuchEntity/RE (runtime exception) listing the offending row's elements. This indicates a row could not be written to the underlying frame/writer (e.g. closed or broken writer).","triggerScenarios":"An IOException thrown by the underlying FrameWriter while serializing a row of a FrameBasedInlineDataSource (commonly used in MSQ/inline tables); the catch block converts it to this RuntimeException with the row contents in the message.","commonSituations":"MSQ tasks building inline tables whose frame writer has hit a capacity/IO failure; memory pressure causing writer failure mid-row; rows with values incompatible with the frame column types.","solutions":["Inspect the row contents in the message and the wrapped cause to see why serialization failed (often a type or capacity mismatch).","Retry the query/task — transient IO issues with the frame writer may resolve.","Check column types in the inline datasource signature match the row values.","If persistent, report/investigate; the code notes this path ideally shouldn't be reachable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  serializer.write(row);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Exception encountered while serializing\")) {\n    // inspect row values and cause; retry task\n  } else { throw e; }\n}","preventionTips":["Ensure row values match the declared RowSignature column types.","Watch MSQ task logs for frame writer capacity/IO warnings.","Retry failed MSQ queries; this path is often transient."],"tags":["serialization","io","inline-datasource","msq"],"backgroundTag":"json-serialization-failed","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"}