{"record":{"id":"5c65602a7c20d5c2","repo":"apache/flink","slug":"get-s-descriptors-error","errorCode":null,"errorMessage":"get %s descriptors error!","messagePattern":"get (.+?) descriptors error!","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/util/PbFormatUtils.java","lineNumber":125,"sourceCode":"                fileDescriptor.getOptions().hasJavaPackage()\n                        ? fileDescriptor.getOptions().getJavaPackage()\n                        : fileDescriptor.getPackage();\n        if (fileDescriptor.getOptions().getJavaMultipleFiles()) {\n            return javaPackageName + \".\";\n        } else {\n            String outerClassName = getOuterClassName(fileDescriptor);\n            return javaPackageName + \".\" + outerClassName + \".\";\n        }\n    }\n\n    public static Descriptors.Descriptor getDescriptor(String className) {\n        try {\n            Class<?> pbClass =\n                    Class.forName(className, true, Thread.currentThread().getContextClassLoader());\n            return (Descriptors.Descriptor)\n                    pbClass.getMethod(PbConstant.PB_METHOD_GET_DESCRIPTOR).invoke(null);\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\n                    String.format(\"get %s descriptors error!\", className), e);\n        }\n    }\n\n    public static boolean isRepeatedType(LogicalType type) {\n        return type instanceof MapType || type instanceof ArrayType;\n    }\n\n    public static boolean isArrayType(LogicalType type) {\n        return type instanceof ArrayType;\n    }\n}\n","sourceCodeStart":107,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/util/PbFormatUtils.java#L107-L138","documentation":"PbFormatUtils.getDescriptor loads the protobuf message class via the thread-context classloader and reflectively invokes its static getDescriptor() method. Any failure (ClassNotFoundException, missing method, invocation exception, wrong type) is wrapped in this IllegalArgumentException with the class name. It is a classpath/wiring problem: the configured protobuf.message-class-name cannot be resolved to a Descriptors.Descriptor in the job's classloader.","triggerScenarios":"'protobuf.message-class-name' points to a class not on the job classpath; the class exists but is not a generated protobuf message (no static getDescriptor); shaded/relocated proto classes where reflection cannot find the method; classloader isolation (planner/user classloader) hiding the proto jar.","commonSituations":"Proto jar not bundled in the Flink job jar; wrong fully-qualified name (old package after regenerating); proto classes compiled with a different protobuf-java version than the runtime; JAR conflicts in lib/.","solutions":["Verify the exact FQCN: it must be the generated message class (e.g. com.example.OrderOuterClass$Order) and match 'protobuf.message-class-name'.","Ensure the jar containing the generated classes is shipped with the job (check the fat jar contents) and not masked by lib/ conflicts.","Regenerate proto classes with the same protoc/protobuf-java version Flink uses.","Confirm getDescriptor() exists: javap or a quick reflection test in the job's classloader."],"exampleFix":"-- before\n'protobuf.message-class-name'='com.example.Order'\n-- after (nested message class)\n'protobuf.message-class-name'='com.example.OrderOuterClass$Order'","handlingStrategy":"validation","validationCode":"String cn = \"com.example.OrderOuterClass$Order\";\nClass<?> c = Class.forName(cn, true, Thread.currentThread().getContextClassLoader());\nif (c.getMethod(\"getDescriptor\").invoke(null) instanceof Descriptors.Descriptor) {\n    // safe to use as protobuf.message-class-name\n}","typeGuard":null,"tryCatchPattern":"try {\n    descriptor = PbFormatUtils.getDescriptor(className);\n} catch (IllegalArgumentException e) {\n    throw new RuntimeException(\"Proto class not loadable in job classloader: \" + className, e);\n}","preventionTips":["Bundle generated proto classes in the job jar and pin protoc/protobuf-java to Flink's version.","Use the exact generated class name ($-nested for inner messages); verify with javap.","Prefer message-class-name validation at deploy time (smoke CREATE TABLE) before production."],"tags":["protobuf","classpath","reflection","configuration"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}