apache/flink · error · RuntimeException

Failed to delegate to ProtoSchemaConverter

Error message

Failed to delegate to ProtoSchemaConverter

What it means

PatchedProtoSchemaConverter.convert reflectively loads org.apache.parquet.proto.ProtoSchemaConverter and delegates schema conversion. If the class is missing, not constructed with a ParquetConfiguration, or invocation fails, it wraps the cause in RuntimeException('Failed to delegate to ProtoSchemaConverter').

Source

Thrown at flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/protobuf/PatchedProtoWriteSupport.java:878

 * if present; else implement minimal mapping. To minimize risk, we reflectively invoke the original
 * ProtoSchemaConverter if available.
 */
class PatchedProtoSchemaConverter {
    private final ParquetConfiguration configuration;

    PatchedProtoSchemaConverter(ParquetConfiguration configuration) {
        this.configuration = configuration;
    }

    MessageType convert(Descriptor descriptor) {
        try {
            Class<?> clazz = Class.forName("org.apache.parquet.proto.ProtoSchemaConverter");
            Object inst =
                    clazz.getConstructor(ParquetConfiguration.class).newInstance(configuration);
            return (MessageType)
                    clazz.getMethod("convert", Descriptor.class).invoke(inst, descriptor);
        } catch (Exception e) {
            throw new RuntimeException("Failed to delegate to ProtoSchemaConverter", e);
        }
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Ensure flink-parquet's parquet-proto dependency (and its correct version) is on the runtime classpath
  2. Check the wrapped cause in the stack trace - it names the exact reflective failure (ClassNotFoundException vs NoSuchMethodException)
  3. Avoid repackaging/shading org.apache.parquet.proto classes away from this code path
Defensive patterns

Strategy: try-catch

Validate before calling

try { Class.forName("org.apache.parquet.proto.ProtoSchemaConverter"); } catch (ClassNotFoundException e) { throw new IllegalStateException("parquet-proto missing on classpath", e); }

Try / catch

try { schema = converter.convert(descriptor); } catch (RuntimeException e) { // inspect e.getCause(): ClassNotFoundException -> classpath; NoSuchMethodException -> parquet-proto version mismatch }

Prevention

When it happens

Trigger: Running the patched write support without parquet-proto's ProtoSchemaConverter on the classpath, or with a parquet-proto version whose ProtoSchemaConverter lacks the ParquetConfiguration constructor or convert(Descriptor) method.

Common situations: Shaded/slimer jars that exclude parquet-proto, a parquet-proto version mismatch after a dependency upgrade, or classloader isolation (e.g. SQL connectors, OSGi) hiding the class.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/ba419b8ccd8c7e24. Report an issue: GitHub.