{"record":{"id":"1b46919fd42a9bed","repo":"apache/pulsar","slug":"filedescriptor-getfullname-can-t-resolve-depe","errorCode":null,"errorMessage":"${fileDescriptor.getFullName()} can't resolve dependency '${unResolvedFileDescriptNames}'.","messagePattern":"(.+?) can't resolve dependency '(.+?)'\\.","errorType":"exception","errorClass":"SchemaSerializationException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java","lineNumber":84,"sourceCode":"        }\n        return schemaDataBytes;\n    }\n\n    private static void serializeFileDescriptor(Descriptors.FileDescriptor fileDescriptor,\n                                                Map<String, FileDescriptorProto> fileDescriptorCache) {\n        fileDescriptor.getDependencies().forEach(dependency -> {\n                    if (!fileDescriptorCache.containsKey(dependency.getFullName())) {\n                        serializeFileDescriptor(dependency, fileDescriptorCache);\n                    }\n                }\n        );\n        String[] unResolvedFileDescriptNames = fileDescriptor.getDependencies().stream().\n                filter(item -> !fileDescriptorCache.containsKey(item.getFullName()))\n                .map(Descriptors.FileDescriptor::getFullName).toArray(String[]::new);\n        if (unResolvedFileDescriptNames.length == 0) {\n            fileDescriptorCache.put(fileDescriptor.getFullName(), fileDescriptor.toProto());\n        } else {\n            throw new SchemaSerializationException(fileDescriptor.getFullName() + \" can't resolve dependency '\"\n                    + Arrays.toString(unResolvedFileDescriptNames) + \"'.\");\n        }\n    }\n\n    private static final ObjectReader PROTOBUF_NATIVE_SCHEMADATA_READER = ObjectMapperFactory.getMapper().reader()\n            .forType(ProtobufNativeSchemaData.class);\n\n    @SuppressWarnings(\"deprecation\")\n    public static Descriptors.Descriptor deserialize(byte[] schemaDataBytes) {\n        Descriptors.Descriptor descriptor;\n        try {\n            ProtobufNativeSchemaData schemaData = PROTOBUF_NATIVE_SCHEMADATA_READER.readValue(schemaDataBytes);\n\n            Map<String, FileDescriptorProto> fileDescriptorProtoCache = new HashMap<>();\n            Map<String, Descriptors.FileDescriptor> fileDescriptorCache = new HashMap<>();\n            FileDescriptorSet fileDescriptorSet = FileDescriptorSet.parseFrom(schemaData.getFileDescriptorSet());\n            fileDescriptorSet.getFileList().forEach(fileDescriptorProto ->\n                    fileDescriptorProtoCache.put(fileDescriptorProto.getName(), fileDescriptorProto));","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java#L66-L102","documentation":"ProtobufNativeSchemaUtils.serializeFileDescriptor caches the file descriptor's own proto and requires all its dependency descriptors to already be in the cache. If any dependency is missing it throws SchemaSerializationException naming the unresolvable dependencies.","triggerScenarios":"Serializing a protobuf FileDescriptor whose proto imports other proto files whose descriptors were never registered (never passed through serializeFileDescriptor before).","commonSituations":"Proto files split across modules where only the top-level descriptor is registered; dependency-order mistakes when seeding the cache; dynamic proto usage where imports were not resolved at compile time.","solutions":["Register dependencies first: call serializeFileDescriptor for each imported proto's FileDescriptor before the top-level one","Build the FileDescriptor with the full Descriptors.FileDescriptor[] dependency array so imports are resolved","Check the proto import paths and that all imported files are on the classpath and compiled"],"exampleFix":"// before\nProtobufNativeSchemaUtils.serializeFileDescriptor(topLevelFd); // imports unresolved\n// after\nProtobufNativeSchemaUtils.serializeFileDescriptor(depFd);\nProtobufNativeSchemaUtils.serializeFileDescriptor(topLevelFd);","handlingStrategy":"validation","validationCode":"List<String> missing = fd.getDependencies().stream().map(Descriptors.FileDescriptor::getFullName)\n    .filter(n -> !isRegistered(n)).collect(Collectors.toList());\nif (!missing.isEmpty()) { throw new IllegalStateException(\"register deps first: \" + missing); }","typeGuard":null,"tryCatchPattern":"try { serializeFileDescriptor(fd); } catch (SchemaSerializationException e) { // register listed dependencies and retry }","preventionTips":["Register all imported FileDescriptors before the top-level one","Construct FileDescriptors with full dependency arrays","Keep proto module boundaries aligned with registration order"],"tags":["protobuf","schema","dependency"],"backgroundTag":"protobuf-dependency-resolution-failed","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}