{"record":{"id":"241ff6d187a0d90d","repo":"apache/beam","slug":"arrowflightio-write-e-getmessage","errorCode":null,"errorMessage":"ArrowFlightIO.write(): e.getMessage()","messagePattern":"ArrowFlightIO\\.write\\(\\): e\\.getMessage\\(\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/arrow-flight/src/main/java/org/apache/beam/sdk/io/arrowflight/ArrowFlightIO.java","lineNumber":143,"sourceCode":"\n  private static byte[] copyToken(byte[] token) {\n    return Arrays.copyOf(checkNotNull(token, \"token\"), token.length);\n  }\n\n  private static CallOption[] callOptions(byte @Nullable [] token) {\n    if (token == null) {\n      return new CallOption[0];\n    }\n    FlightCallHeaders headers = new FlightCallHeaders();\n    headers.insert(\"authorization\", \"Bearer \" + new String(token, StandardCharsets.UTF_8));\n    return new CallOption[] {new HeaderCallOption(headers)};\n  }\n\n  private static void validateWriteSchema(Schema schema) {\n    try {\n      ArrowConversion.ArrowSchemaTranslator.toArrowSchema(schema);\n    } catch (IllegalArgumentException e) {\n      throw new IllegalArgumentException(\"ArrowFlightIO.write(): \" + e.getMessage(), e);\n    }\n  }\n\n  public static Read read() {\n    return new AutoValue_ArrowFlightIO_Read.Builder().setPort(47470).setUseTls(false).build();\n  }\n\n  public static Write write() {\n    return new AutoValue_ArrowFlightIO_Write.Builder()\n        .setPort(47470)\n        .setUseTls(false)\n        .setBatchSize(1024)\n        .build();\n  }\n\n  /**\n   * Creates a {@link FlightClient} from the given connection parameters.\n   *","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/arrow-flight/src/main/java/org/apache/beam/sdk/io/arrowflight/ArrowFlightIO.java#L125-L161","documentation":"ArrowFlightIO.validateWriteSchema converts the Beam Schema to an Arrow schema; if that conversion throws IllegalArgumentException (a Beam type unsupported by Arrow conversion), it is rethrown as 'ArrowFlightIO.write(): <reason>'. The sink's schema cannot be represented in Arrow.","triggerScenarios":"PCollection<Row> with a schema containing types that ArrowConversion.ArrowSchemaTranslator.toArrowSchema cannot map, passed to ArrowFlightIO.write().","commonSituations":"Nested/logical or custom logical types in the Beam schema, schema produced dynamically from data that includes exotic field types, Beam/Arrow version mismatches.","solutions":["Inspect the chained cause to find the unsupported field type and remove or map it to a supported type.","Convert unsupported fields to strings or primitives before writing.","Upgrade Beam to a version whose Arrow schema translation supports your types.","Test schema translation locally with ArrowConversion.ArrowSchemaTranslator.toArrowSchema(schema) before submitting the pipeline."],"exampleFix":"// before\nRow with LogicalType customField...\n.apply(ArrowFlightIO.write());\n// after\nrow.set(\"customField\", customField.toString()); // map to supported STRING type\n.apply(ArrowFlightIO.write());","handlingStrategy":"validation","validationCode":"// before submitting, verify the Beam schema translates to Arrow\nArrowConversion.ArrowSchemaTranslator.toArrowSchema(pcoll.getSchema());","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.apply(ArrowFlightIO.write());\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"ArrowFlightIO.write():\")) {\n    log.error(\"Schema contains a Beam type not representable in Arrow\", e);\n  }\n}","preventionTips":["Stick to primitive and well-supported nested Beam schema types for Flight writes","Run schema translation in a unit test before deploying","Avoid custom logical types in Flight sink schemas","Keep Beam and Arrow dependencies aligned"],"tags":["arrow","flight","schema","beam"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}