{"record":{"id":"feef5c25016dbf43","repo":"XINCGer/Unity3DTraining","slug":"invalid-public-dependency-name","errorCode":null,"errorMessage":"Invalid public dependency: {name}","messagePattern":"Invalid public dependency: (.+?)","errorType":"validation","errorClass":"DescriptorValidationException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FileDescriptor.cs","lineNumber":111,"sourceCode":"            foreach (var file in dependencies)\n            {\n                nameToFileMap[file.Name] = file;\n            }\n            var publicDependencies = new List<FileDescriptor>();\n            for (int i = 0; i < proto.PublicDependency.Count; i++)\n            {\n                int index = proto.PublicDependency[i];\n                if (index < 0 || index >= proto.Dependency.Count)\n                {\n                    throw new DescriptorValidationException(@this, \"Invalid public dependency index.\");\n                }\n                string name = proto.Dependency[index];\n                FileDescriptor file = nameToFileMap[name];\n                if (file == null)\n                {\n                    if (!allowUnknownDependencies)\n                    {\n                        throw new DescriptorValidationException(@this, \"Invalid public dependency: \" + name);\n                    }\n                    // Ignore unknown dependencies.\n                }\n                else\n                {\n                    publicDependencies.Add(file);\n                }\n            }\n            return new ReadOnlyCollection<FileDescriptor>(publicDependencies);\n        }\n\n        /// <value>\n        /// The descriptor in its protocol message representation.\n        /// </value>\n        internal readonly FileDescriptorProto Proto;\n\n        /// <value>\n        /// The file name.","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FileDescriptor.cs#L93-L129","documentation":"After resolving a public dependency index to a dependency name, DeterminePublicDependencies looks it up in the nameToFileMap. If the named file has no known FileDescriptor and allowUnknownDependencies is false, a DescriptorValidationException is thrown. Unknown dependencies can only be tolerated when explicitly allowed (as generated code does).","triggerScenarios":"FileDescriptor.BuildFrom called with allowUnknownDependencies=false while the FileDescriptorProto declares a dependency (or public dependency) whose FileDescriptor was not supplied in the dependencies collection — e.g. importing 'google/protobuf/timestamp.proto' without passing its descriptor.","commonSituations":"Missing well-known-type descriptors (timestamp, duration, wrappers, any); forgetting to add an imported .proto's descriptor to the dependencies array; descriptors regenerated with a new import but callers not updated.","solutions":["Pass the FileDescriptor for every imported file in the dependencies argument to BuildFrom, in the same order as proto.Dependency.","Add descriptors for the well-known types (Google.Protobuf.Reflection includes them via DescriptorReflection or generated files).","Regenerate code so descriptor data, dependencies, and imports agree.","Use allowUnknownDependencies=true only if the unknown import's types are genuinely unused."],"exampleFix":"// before\nFileDescriptor.BuildFrom(data, proto, new FileDescriptor[0], false, null); // proto imports timestamp.proto\n// after\nFileDescriptor.BuildFrom(data, proto, new[] { TimestampReflection.Descriptor }, false, null);","handlingStrategy":"try-catch","validationCode":"bool AllDepsKnown(FileDescriptorProto p, IDictionary<string,FileDescriptor> map) => p.Dependency.All(d => map.ContainsKey(d));","typeGuard":null,"tryCatchPattern":"try { BuildFrom(data, proto, deps, false, null); } catch (DescriptorValidationException e) when (e.Message.StartsWith(\"Invalid public dependency:\")) { log.LogError($\"Missing descriptor for import: {e.Message}\"); }","preventionTips":["Pass a FileDescriptor for every import, including google/protobuf well-known types.","Keep the dependencies array order aligned with proto.Dependency.","Enable allowUnknownDependencies only when imports are provably unused."],"tags":["protobuf","descriptor","dependency","reflection"],"backgroundTag":"missing-dependency","analyzedSha":"016f98412ea5e11756b286736f479b66ab6216d5","analyzedAt":"2026-09-12T01:08:58.711Z","contentChangedAt":"2026-09-12T01:08:58.711Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}