apache/beam · error · IllegalArgumentException

at key is not supported

Error message

%s at key %s is not supported

What it means

XmlRowValue.setValue walks a Beam Row to emit XML and, upon encountering a field type it cannot represent in XML (an unsupported FieldType TypeName), throws IllegalArgumentException naming the type and key. The XML sink supports only the primitive/row/array/datetime cases handled before the default branch.

Solutions

  1. Remove or flatten the unsupported field type from the schema
  2. Convert MAP (or other unsupported) fields into repeated ROWs before writing
  3. Choose a format that supports the type (Parquet/Avro) instead of XML

Example fix

// before
Schema with MAP field passed to XML sink
// after
row.getArray("my_map_entries") // pre-transform MAP into ARRAY<ROW<key,value>> before the XML sink
Defensive patterns

Strategy: validation

Validate before calling

for (Field f : row.getSchema().getFields()) { if (f.getType().getTypeName() == TypeName.MAP) throw new IllegalStateException("field " + f.getName() + " unsupported by XML sink"); }

Type guard

boolean xmlWritable(Schema s) { return s.getFields().stream().allMatch(f -> f.getType().getTypeName() != TypeName.MAP); }

Try / catch

try { applyXmlSink(row); } catch (IllegalArgumentException e) { if (e.getMessage().contains("is not supported")) { convertSchemaAndRetry(row); } else throw e; }

Prevention

When it happens

Trigger: Writing a schema containing an unsupported field type (e.g. MAP or other non-primitive nested type at a top-level or nested key) through the XML file-schema-transform sink.

Common situations: Schemas evolved to add MAP fields; reusing a generic Row schema written for Avro/Parquet with the XML sink.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5cda13e2db8abbd1. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/file-schema-transform/src/main/java/org/apache/beam/sdk/io/fileschematransform/XmlRowValue.java:136

      case INT32:
      case INT64:
      case STRING:
        primitiveValue = parent.getValue(key);
        return;
      case ARRAY:
      case ITERABLE:
        setArrayValue(key, field, parent);
        return;
      case DATETIME:
        setDateTimeValue(key, parent);
        return;
      case ROW:
        Optional<Row> child = Optional.ofNullable(parent.getRow(key));
        checkState(child.isPresent());
        setNestedValue(child.get());
        return;
      default:
        throw new IllegalArgumentException(
            String.format("%s at key %s is not supported", typeName.name(), key));
    }
  }

  private void setArrayValue(String key, Field field, Row parent) {
    Optional<FieldType> collectionFieldType =
        Optional.ofNullable(field.getType().getCollectionElementType());
    checkState(collectionFieldType.isPresent());
    TypeName collectionFieldTypeName = collectionFieldType.get().getTypeName();
    Optional<Iterable<Object>> iterable = Optional.ofNullable(parent.getIterable(key));
    checkState(iterable.isPresent());
    valueList = new ArrayList<>();
    Optional<ArrayList<XmlRowValue>> safeValueList = Optional.of(valueList);

    switch (collectionFieldTypeName) {
      case BOOLEAN:
      case BYTE:
      case DECIMAL:

View on GitHub (pinned to 12126d8942)