{"record":{"id":"99becd5ee7fdd69e","repo":"apache/pulsar","slug":"filedescriptorproto-getname-can-t-resolve","errorCode":null,"errorMessage":"'${fileDescriptorProto.getName()}' can't resolve  dependency '${dependency}'.","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":145,"sourceCode":"    }\n\n    private static void deserializeFileDescriptor(FileDescriptorProto fileDescriptorProto,\n                                                  Map<String, Descriptors.FileDescriptor> fileDescriptorCache,\n                                                  Map<String, FileDescriptorProto> fileDescriptorProtoCache) {\n        fileDescriptorProto.getDependencyList().forEach(dependencyFileDescriptorName -> {\n            if (!fileDescriptorCache.containsKey(dependencyFileDescriptorName)) {\n                FileDescriptorProto dependencyFileDescriptor =\n                        fileDescriptorProtoCache.get(dependencyFileDescriptorName);\n                deserializeFileDescriptor(dependencyFileDescriptor, fileDescriptorCache, fileDescriptorProtoCache);\n            }\n        });\n\n        Descriptors.FileDescriptor[] dependencyFileDescriptors = fileDescriptorProto.getDependencyList().stream()\n                .map(dependency -> {\n            if (fileDescriptorCache.containsKey(dependency)) {\n                return fileDescriptorCache.get(dependency);\n            } else {\n                throw new SchemaSerializationException(\"'\" + fileDescriptorProto.getName()\n                        + \"' can't resolve  dependency '\" + dependency + \"'.\");\n            }\n        }).toArray(Descriptors.FileDescriptor[]::new);\n\n        try {\n            Descriptors.FileDescriptor fileDescriptor = Descriptors.FileDescriptor\n                    .buildFrom(fileDescriptorProto, dependencyFileDescriptors);\n            fileDescriptorCache.put(fileDescriptor.getFullName(), fileDescriptor);\n        } catch (Descriptors.DescriptorValidationException e) {\n            e.printStackTrace();\n            throw new SchemaSerializationException(e);\n        }\n    }\n\n}\n","sourceCodeStart":127,"sourceCodeEnd":161,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java#L127-L161","documentation":"ProtobufNativeSchemaUtils.deserializeFileDescriptor rebuilds a FileDescriptor from its serialized proto and looks up each dependency in the local fileDescriptorCache. A dependency name missing from the cache triggers SchemaSerializationException listing the unresolvable dependency.","triggerScenarios":"Deserializing schema data produced elsewhere (e.g. from a broker) when the consumer-side process never registered/seeded the dependency descriptors; consuming protobuf-native schemas from protos with imports.","commonSituations":"Multi-module projects where only the top-level descriptor is cached; schema written by a different service whose imports are unknown locally; ordering issues where deserialize is called before dependencies were registered.","solutions":["Call deserializeFileDescriptor (or serialize) for each dependency descriptor first, then the top-level one","Bundle the generated classes/protos of all imported files so they can be registered locally","Simplify the proto to avoid external imports if dependency propagation is impractical"],"exampleFix":"// before\nDescriptors.FileDescriptor fd = ProtobufNativeSchemaUtils.deserializeFileDescriptor(schemaData);\n// after\nProtobufNativeSchemaUtils.deserializeFileDescriptor(depSchemaData); // seed dependency first\nDescriptors.FileDescriptor fd = ProtobufNativeSchemaUtils.deserializeFileDescriptor(schemaData);","handlingStrategy":"validation","validationCode":"Set<String> cached = getRegisteredDependencyNames();\nList<String> missing = schemaData.getDependencyList().stream().filter(d -> !cached.contains(d)).collect(Collectors.toList());\nif (!missing.isEmpty()) { throw new IllegalStateException(\"missing deps: \" + missing); }","typeGuard":null,"tryCatchPattern":"try { deserializeFileDescriptor(data); } catch (SchemaSerializationException e) { // register missing dependency descriptors, then retry }","preventionTips":["Seed the descriptor cache with all imports before deserializing","Ship generated classes for every imported proto","Assume schemas from other services may reference deps unknown locally"],"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-14T05:17:10.506Z"}