{"record":{"id":"d71f935d0f45a625","repo":"apache/iceberg","slug":"visitor-does-not-support-variant","errorCode":null,"errorMessage":"Visitor does not support variant","messagePattern":"Visitor does not support variant","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/avro/AvroWithPartnerByStructureVisitor.java","lineNumber":221,"sourceCode":"\n  public T union(P type, Schema union, List<T> options) {\n    return null;\n  }\n\n  public T array(P sArray, Schema array, T element) {\n    return null;\n  }\n\n  public T map(P sMap, Schema map, T key, T value) {\n    return null;\n  }\n\n  public T map(P sMap, Schema map, T value) {\n    return null;\n  }\n\n  public T variant(P partner, T metadata, T value) {\n    throw new UnsupportedOperationException(\"Visitor does not support variant\");\n  }\n\n  public T primitive(P type, Schema primitive) {\n    return null;\n  }\n}\n","sourceCodeStart":203,"sourceCodeEnd":228,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/avro/AvroWithPartnerByStructureVisitor.java#L203-L228","documentation":"Visitor guard in AvroWithPartnerByStructureVisitor: the schema contains a variant type (metadata+value pair), and this particular visitor implementation did not override the variant() visitor method. Unlike the sibling methods that return null for unneeded types, variant is a hard guard, so any Avro schema with variant fails traversal for this visitor.","triggerScenarios":"Thrown at core/src/main/java/org/apache/iceberg/avro/AvroWithPartnerByStructureVisitor.java:221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a visitor implementation that overrides variant() when reading/writing variant data","Remove variant-typed columns from the schema before the Avro conversion","Upgrade Iceberg to a version whose visitors support variant"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}