apache/iceberg · error · IllegalArgumentException

The value type ' is not yet supported inside for a…

Error message

The value type '${valueType} is not yet supported inside for a subSchema.

What it means

MongoDataConverter.subSchema throws IllegalArgumentException when it encounters a BSON value type inside a nested sub-schema (e.g. inside arrays of documents) that the converter does not support. Only known BSON types are mapped to Connect schemas.

Solutions

  1. Convert the unsupported BSON type to a supported one (e.g. store decimals as strings) in MongoDB.
  2. Use a different array.encoding setting (e.g. array encoding as JSON string) to avoid nested schema inference.
  3. Restructure the document to avoid the unsupported type inside nested arrays.

Example fix

// before
db.coll.insertOne({arr: [[Decimal128("1.2")]]})
// after
db.coll.insertOne({arr: [["1.2"]]})
Defensive patterns

Strategy: validation

Validate before calling

// Pre-scan nested array element BsonTypes against supported set
java.util.Set<BsonType> supported = java.util.Set.of(BsonType.STRING, BsonType.INT32, BsonType.INT64, BsonType.DOUBLE, BsonType.BOOLEAN, BsonType.DOCUMENT, BsonType.ARRAY, BsonType.NULL);
if (!supported.contains(innerElement.getBsonType())) throw new IllegalStateException("unsupported nested BSON type: " + innerElement.getBsonType());

Try / catch

try { ... } catch (IllegalArgumentException e) { log.error("Unsupported BSON type in sub-schema: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Building the schema for an array-of-arrays (subSchema recursion) where the inner element's BsonType falls into the switch's default branch — e.g. exotic BSON types like DECIMAL128, TIMESTAMP, or binary in nested positions.

Common situations: MongoDB documents using newer BSON types (Decimal128, timestamps) inside nested arrays processed with array.encoding=struct.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/c6d6ff8fca3c9872. Report an issue: GitHub.

Appendix: source

Thrown at kafka-connect/kafka-connect-transforms/src/main/java/org/debezium/connector/mongodb/transforms/MongoDataConverter.java:435

          value
              .asArray()
              .forEach(f -> subSchema(documentSchemaBuilder, union, f.asDocument(), true));
          if (documentSchemaBuilder.fields().isEmpty()) {
            value
                .asArray()
                .forEach(f -> subSchema(documentSchemaBuilder, union, f.asDocument(), false));
          }
        } else {
          subSchema(documentSchemaBuilder, union, value.asDocument(), false);
        }
        return documentSchemaBuilder.build();
      case ARRAY:
        BsonType subValueType = value.asArray().get(0).asArray().get(0).getBsonType();
        return SchemaBuilder.array(subSchema(builder, key, subValueType, value.asArray().get(0)))
            .optional()
            .build();
      default:
        throw new IllegalArgumentException(
            "The value type '" + valueType + " is not yet supported inside for a subSchema.");
    }
  }

  private void subSchema(
      SchemaBuilder documentSchemaBuilder,
      Map<String, BsonType> union,
      BsonDocument arrayDocs,
      boolean emptyChecker) {
    for (Entry<String, BsonValue> arrayDoc : arrayDocs.entrySet()) {
      final String key = arrayDoc.getKey();
      if (emptyChecker
          && ((arrayDoc.getValue() instanceof BsonDocument
                  && ((BsonDocument) arrayDoc.getValue()).isEmpty())
              || (arrayDoc.getValue() instanceof BsonArray
                  && ((BsonArray) arrayDoc.getValue()).isEmpty()))) {
        continue;
      }

View on GitHub (pinned to 86d9c8fc54)