{"record":{"id":"b03efeb85cfd053c","repo":"XINCGer/Unity3DTraining","slug":"typename-is-not-a-type","errorCode":null,"errorMessage":"\"TypeName\" is not a type.","messagePattern":"\"TypeName\" is not a type\\.","errorType":"validation","errorClass":"DescriptorValidationException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FieldDescriptor.cs","lineNumber":317,"sourceCode":"            if (Proto.TypeName != \"\")\n            {\n                IDescriptor typeDescriptor =\n                    File.DescriptorPool.LookupSymbol(Proto.TypeName, this);\n\n                if (Proto.Type != 0)\n                {\n                    // Choose field type based on symbol.\n                    if (typeDescriptor is MessageDescriptor)\n                    {\n                        fieldType = FieldType.Message;\n                    }\n                    else if (typeDescriptor is EnumDescriptor)\n                    {\n                        fieldType = FieldType.Enum;\n                    }\n                    else\n                    {\n                        throw new DescriptorValidationException(this, \"\\\"\" + Proto.TypeName + \"\\\" is not a type.\");\n                    }\n                }\n\n                if (fieldType == FieldType.Message)\n                {\n                    if (!(typeDescriptor is MessageDescriptor))\n                    {\n                        throw new DescriptorValidationException(this, \"\\\"\" + Proto.TypeName + \"\\\" is not a message type.\");\n                    }\n                    messageType = (MessageDescriptor)typeDescriptor;\n\n                    if (Proto.DefaultValue != \"\")\n                    {\n                        throw new DescriptorValidationException(this, \"Messages can't have default values.\");\n                    }\n                }\n                else if (fieldType == FieldType.Enum)\n                {","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FieldDescriptor.cs#L299-L335","documentation":"During CrossLink, a field that uses type_name (rather than an inline type) must resolve, via the descriptor pool, to either a MessageDescriptor or an EnumDescriptor. If the resolved symbol is neither, the field's TypeName points at something that exists but is not a type (e.g. a service or another field), and DescriptorValidationException is thrown.","triggerScenarios":"A FieldDescriptorProto whose Type is TYPE_MESSAGE/TYPE_ENUM but whose TypeName resolves to a non-type symbol in the pool — e.g. TypeName pointing at a service, method, or field; misspelled or wrongly-scoped fully-qualified type names in hand-built protos.","commonSituations":"Hand-assembling descriptors with wrong fully-qualified names; renaming/merging protos so a type_name now collides with a non-type symbol; stale generated descriptor sets after refactors.","solutions":["Fix Proto.TypeName to the correct fully-qualified message or enum name and regenerate/rebuild the descriptor.","Verify with DescriptorPool.LookupSymbol / FindName that the name resolves to a MessageDescriptor or EnumDescriptor before building.","Regenerate descriptors from the .proto source with protoc instead of editing serialized descriptor bytes."],"exampleFix":"// before\ntypeName = \"MyApp.Services.MyService\" // resolves to a service, not a type\n// after\ntypeName = \"MyApp.Messages.MyMessage\"","handlingStrategy":"validation","validationCode":"var sym = pool.LookupSymbol(field.Proto.TypeName, field);\nif (!(sym is MessageDescriptor) && !(sym is EnumDescriptor))\n    throw new InvalidDataException(field.Proto.TypeName + \" is not a message or enum type\");","typeGuard":"bool IsNamedType(string typeName, DescriptorPool pool, out object sym)\n{ sym = pool.FindSymbol(typeName); return sym is MessageDescriptor || sym is EnumDescriptor; }","tryCatchPattern":"try { descriptor = FileDescriptor.BuildFromByteStrings(data); }\ncatch (DescriptorValidationException ex)\n{ log.LogError(ex, \"type_name does not resolve to a type: \" + ex.Message); }","preventionTips":["Use fully-qualified type names exactly as protoc generates them.","Regenerate descriptors after renaming or merging types in .proto files.","Validate type_name resolution before feeding descriptors to the builder."],"tags":["protobuf","descriptor-validation","cross-link"],"backgroundTag":"incompatible-source-type","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"}