{"record":{"id":"b720ca50a1a01074","repo":"XINCGer/Unity3DTraining","slug":"fullname-is-already-defined-in-file-old-file","errorCode":null,"errorMessage":"\"{fullName}\" is already defined in file \"{old.File.Name}\".","messagePattern":"\"(.+?)\" is already defined in file \"(.+?)\"\\.","errorType":"validation","errorClass":"DescriptorValidationException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/DescriptorPool.cs","lineNumber":179,"sourceCode":"                int dotPos = fullName.LastIndexOf('.');\n                string message;\n                if (descriptor.File == old.File)\n                {\n                    if (dotPos == -1)\n                    {\n                        message = \"\\\"\" + fullName + \"\\\" is already defined.\";\n                    }\n                    else\n                    {\n                        message = \"\\\"\" + fullName.Substring(dotPos + 1) + \"\\\" is already defined in \\\"\" +\n                                  fullName.Substring(0, dotPos) + \"\\\".\";\n                    }\n                }\n                else\n                {\n                    message = \"\\\"\" + fullName + \"\\\" is already defined in file \\\"\" + old.File.Name + \"\\\".\";\n                }\n                throw new DescriptorValidationException(descriptor, message);\n            }\n            descriptorsByName[fullName] = descriptor;\n        }\n\n        private static readonly Regex ValidationRegex = new Regex(\"^[_A-Za-z][_A-Za-z0-9]*$\",\n                                                                  FrameworkPortability.CompiledRegexWhereAvailable);\n\n        /// <summary>\n        /// Verifies that the descriptor's name is valid (i.e. it contains\n        /// only letters, digits and underscores, and does not start with a digit).\n        /// </summary>\n        /// <param name=\"descriptor\"></param>\n        private static void ValidateSymbolName(IDescriptor descriptor)\n        {\n            if (descriptor.Name == \"\")\n            {\n                throw new DescriptorValidationException(descriptor, \"Missing name.\");\n            }","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/DescriptorPool.cs#L161-L197","documentation":"DescriptorPool.AddSymbol throws DescriptorValidationException when a message, enum, service, or enum value descriptor is registered under a fully-qualified name that already exists in the pool. Protobuf requires every fully-qualified symbol within a file's set of descriptors to be unique; duplicate registration is a validation error.","triggerScenarios":"Building a FileDescriptor (BuildFromByteString, FromGeneratedCode, or building dependent descriptors) where two declarations resolve to the same fully-qualified name — e.g. two messages with the same name in the same package, or an enum value colliding with a sibling type (enum values share the enclosing scope's namespace in proto2 semantics).","commonSituations":"Duplicate message names across .proto files sharing one package; an enum value name equal to another type name in the same scope (proto2 C++ scoping rules); concatenating multiple FileDescriptorSets that both contain the same file; a build pipeline shipping stale and new generated descriptors together.","solutions":["Find the duplicate fully-qualified name in the .proto files and rename one of the conflicting declarations.","Ensure the same .proto file is not registered twice in one descriptor pool (deduplicate your FileDescriptorSet).","Rename enum values that collide with sibling types, or wrap the enum in a message to scope its values (proto3 style).","Regenerate all descriptors from the corrected .proto sources."],"exampleFix":"// before\npackage myapp;\nmessage User {}\nmessage User {} // duplicate\n// after\npackage myapp;\nmessage User {}\nmessage UserProfile {} // unique name","handlingStrategy":"validation","validationCode":"// Deduplicate file names before building:\nvar uniqueDeps = dependencies\n    .GroupBy(d => d.Name)\n    .Select(g => g.First())\n    .ToList();","typeGuard":null,"tryCatchPattern":"try\n{\n    var fd = FileDescriptor.BuildFromByteString(bytes, dependencies);\n}\ncatch (DescriptorValidationException ex) when (ex.Message.Contains(\"is already defined in file\"))\n{\n    // identify duplicate symbol from ex.Message and drop/rename the duplicate\n}","preventionTips":["Run a protoc lint (buf lint) that flags duplicate symbols across files","Never register the same file twice in one pool","Rename enum values that share a scope with sibling types (proto3 packaging style)"],"tags":["protobuf","descriptor","duplicate-symbol","csharp"],"backgroundTag":"schema-validation-failed","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"}