{"record":{"id":"af21894c12136bb7","repo":"apache/iceberg","slug":"invalid-binary-type-found-in-orc-type-attribute","errorCode":null,"errorMessage":"Invalid Binary type found in ORC type attribute","messagePattern":"Invalid Binary type found in ORC type attribute","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"orc/src/main/java/org/apache/iceberg/orc/OrcToIcebergVisitor.java","lineNumber":239,"sourceCode":"        binary.getAttributeValue(ORCSchemaUtil.ICEBERG_BINARY_TYPE_ATTRIBUTE);\n    ORCSchemaUtil.BinaryType binaryType =\n        binaryAttributeValue == null\n            ? ORCSchemaUtil.BinaryType.BINARY\n            : ORCSchemaUtil.BinaryType.valueOf(binaryAttributeValue);\n    switch (binaryType) {\n      case UUID:\n        builder.ofType(Types.UUIDType.get());\n        break;\n      case FIXED:\n        int fixedLength =\n            Integer.parseInt(binary.getAttributeValue(ORCSchemaUtil.ICEBERG_FIELD_LENGTH));\n        builder.ofType(Types.FixedType.ofLength(fixedLength));\n        break;\n      case BINARY:\n        builder.ofType(Types.BinaryType.get());\n        break;\n      default:\n        throw new IllegalStateException(\"Invalid Binary type found in ORC type attribute\");\n    }\n  }\n}\n","sourceCodeStart":221,"sourceCodeEnd":243,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/orc/src/main/java/org/apache/iceberg/orc/OrcToIcebergVisitor.java#L221-L243","documentation":"ORC stores Iceberg binary-family types (binary, fixed(n)) in a BINARY column plus the ICEBERG_BINARY_TYPE_ATTRIBUTE. convertBinary switches on that attribute to produce Types.FixedType.ofLength or Types.BinaryType; any unrecognized value throws IllegalStateException('Invalid Binary type found in ORC type attribute').","triggerScenarios":"OrcToIcebergVisitor.primitive → convertBinary on an ORC BINARY column whose ICEBERG_BINARY_TYPE_ATTRIBUTE is not one of the recognized values (fixed with a valid length, or binary/default).","commonSituations":"ORC files produced by external engines or custom forks with different attribute conventions; corrupted or truncated attribute values (e.g. missing length); writer/reader Iceberg version skew.","solutions":["Correct ICEBERG_BINARY_TYPE_ATTRIBUTE: remove it for Types.BinaryType, or set the expected fixed-length marker with a valid integer length for FixedType.","Rewrite the ORC file using Iceberg's ORC writer so attributes are canonical.","Align reader and writer Iceberg versions.","If a fixed-length value fails to parse, verify the attribute string contains a valid numeric length."],"exampleFix":"// before\nICEBERG_BINARY_TYPE_ATTRIBUTE = \"fixed\" // missing length\n// after\nICEBERG_BINARY_TYPE_ATTRIBUTE = \"fixed:16\" // or remove for BinaryType","handlingStrategy":"validation","validationCode":"String attr = orcBinary.getAttributeValue(ORCSchemaUtil.ICEBERG_BINARY_TYPE_ATTRIBUTE);\nboolean binary = attr == null || ORCSchemaUtil.BINARY.equals(attr);\nboolean fixed = attr != null && attr.startsWith(\"fixed\") && parseLength(attr) > 0;\nif (!binary && !fixed) { throw new IllegalArgumentException(\"Bad BINARY attribute: \" + attr); }","typeGuard":null,"tryCatchPattern":"try { schema = ORCSchemaUtil.convert(orcSchema); } catch (IllegalStateException e) { if (e.getMessage().contains(\"Invalid Binary type\")) { fixBinaryAttribute(file); } else throw e; }","preventionTips":["Verify fixed-length attributes carry a valid integer length","Prefer rewriting external ORC files through Iceberg's writer","Add a pre-ingest schema validation pass using ORCSchemaUtil.convert"],"tags":["orc","binary-type","type-attribute","fixed-length"],"backgroundTag":"invalid-enum-value","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"}