apache/iceberg · warning · UnsupportedOperationException
org.apache.iceberg.arrow.vectorized.ArrowVectorAccessors can
Error message
org.apache.iceberg.arrow.vectorized.ArrowVectorAccessors cannot be instantiated.
What it means
ArrowVectorAccessors is a static-utility holder (its constructor is private and intentionally throws). Any attempt to instantiate it via reflection or new reaches this guard. This is an anti-instantiation idiom protecting a class that only exposes static factory methods like getVectorAccessor.
Source
Thrown at arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java:49
private static final GenericArrowVectorAccessorFactory<?, String, ?, ?> FACTORY;
static {
FACTORY =
new GenericArrowVectorAccessorFactory<>(
JavaDecimalFactory::new,
JavaStringFactory::new,
throwingSupplier("Struct type is not supported"),
throwingSupplier("List type is not supported"));
}
private static <T> Supplier<T> throwingSupplier(String message) {
return () -> {
throw new UnsupportedOperationException(message);
};
}
private ArrowVectorAccessors() {
throw new UnsupportedOperationException(
ArrowVectorAccessors.class.getName() + " cannot be instantiated.");
}
static ArrowVectorAccessor<?, String, ?, ?> getVectorAccessor(VectorHolder holder) {
return FACTORY.getVectorAccessor(holder);
}
private static final class JavaStringFactory implements StringFactory<String> {
@Override
public Class<String> getGenericClass() {
return String.class;
}
@Override
public String ofRow(VarCharVector vector, int rowId) {
return ofBytes(vector.get(rowId));
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Use the static methods (ArrowVectorAccessors.getVectorAccessor(holder)) instead of instantiating the class
- Exclude utility classes from reflection-based instantiation/scanning
- Mark the class final/private-constructor usage correctly in framework configs
Example fix
// before ArrowVectorAccessors accessors = ctor.newInstance(); // throws // after ArrowVectorAccessor<?, String, ?, ?> a = ArrowVectorAccessors.getVectorAccessor(holder);
Defensive patterns
Strategy: type-guard
Type guard
boolean isUtilityClass(Class<?> c) { try { c.getDeclaredConstructor(); return c.getDeclaredConstructor().canAccess(null) == false; } catch (NoSuchMethodException e) { return true; } } Try / catch
try { ctor.setAccessible(true); ctor.newInstance(); } catch (InvocationTargetException e) { /* use static methods instead */ } Prevention
- Call static utility methods directly; never instantiate holder classes
- Exclude *Accessors utility classes from classpath scanners and DI bean discovery
- Avoid reflective instantiation of framework-internal classes
When it happens
Trigger: Calling new ArrowVectorAccessors() (blocked at compile time, so realistically via reflection, serialization frameworks, or code generators), or frameworks that force instantiation of classes found by classpath scanning.
Common situations: Reflection-based utilities (e.g. Class.newInstance in old serialization or DI frameworks) touching the class; accidentally treating the utility class as a bean.
Related errors
- Cannot initialize AdlsTokenCredentialProvider, missing no-ar
- Failed to instantiate DynamicRecordGeneratorSQL %s
- Failed to instantiate DynamicRecordGeneratorSQL %s
- Failed to instantiate DynamicRecordGeneratorSQL %s
- Failed to instantiate DynamicRecordGeneratorSQL %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/a52c9e425e392d00.
Report an issue: GitHub.