{"record":{"id":"0b0f1781cecbe42f","repo":"XINCGer/Unity3DTraining","slug":"invalid-type-specified","errorCode":null,"errorMessage":"Invalid type specified","messagePattern":"Invalid type specified","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FieldDescriptor.cs","lineNumber":184,"sourceCode":"                    return FieldType.Group;\n                case FieldDescriptorProto.Types.Type.Message:\n                    return FieldType.Message;\n                case FieldDescriptorProto.Types.Type.Bytes:\n                    return FieldType.Bytes;\n                case FieldDescriptorProto.Types.Type.Uint32:\n                    return FieldType.UInt32;\n                case FieldDescriptorProto.Types.Type.Enum:\n                    return FieldType.Enum;\n                case FieldDescriptorProto.Types.Type.Sfixed32:\n                    return FieldType.SFixed32;\n                case FieldDescriptorProto.Types.Type.Sfixed64:\n                    return FieldType.SFixed64;\n                case FieldDescriptorProto.Types.Type.Sint32:\n                    return FieldType.SInt32;\n                case FieldDescriptorProto.Types.Type.Sint64:\n                    return FieldType.SInt64;\n                default:\n                    throw new ArgumentException(\"Invalid type specified\");\n            }\n        }\n\n        /// <summary>\n        /// Returns <c>true</c> if this field is a repeated field; <c>false</c> otherwise.\n        /// </summary>\n        public bool IsRepeated\n        {\n            get\n            {\n                return Proto.Label == FieldDescriptorProto.Types.Label.Repeated;\n            }\n        }\n\n        /// <summary>\n        /// Returns <c>true</c> if this field is a map field; <c>false</c> otherwise.\n        /// </summary>\n        public bool IsMap","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FieldDescriptor.cs#L166-L202","documentation":"GetFieldTypeFromProtoType maps a FieldDescriptorProto.Type enum value to the public FieldType enum; if it encounters a Type value it does not recognize, it throws ArgumentException(\"Invalid type specified\"). This happens when the descriptor carries an unknown or out-of-range wire enum value (e.g. a newer proto syntax/type added after this plugin was compiled).","triggerScenarios":"Constructing a FieldDescriptor whose proto.Type is not one of the FieldDescriptorProto.Types values known to this Google.Protobuf version, typically from a serialized FileDescriptorProto produced by a newer protoc, or by casting an arbitrary int into FieldDescriptorProto.Types.Type.","commonSituations":"Mixing descriptor files generated by a newer protoc with an old bundled Google.Protobuf plugin; manual int-to-enum casts when building protos dynamically.","solutions":["Upgrade the bundled Google.Protobuf plugin to a version matching (or newer than) the protoc that produced the descriptor.","Regenerate the descriptor with a protoc version compatible with the plugin's known Type values.","Validate the proto.Type value against Enum.IsDefined(typeof(FieldDescriptorProto.Types.Type), value) before constructing descriptors from untrusted input."],"exampleFix":"// before\ntype = (FieldDescriptorProto.Types.Type)rawInt;\n// after\nif (Enum.IsDefined(typeof(FieldDescriptorProto.Types.Type), rawInt))\n    type = (FieldDescriptorProto.Types.Type)rawInt;\nelse\n    throw new InvalidDataException(\"Unknown field type \" + rawInt);","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(FieldDescriptorProto.Types.Type), field.Proto.Type))\n    throw new InvalidDataException($\"Unknown field type value {(int)field.Proto.Type}\");","typeGuard":"bool IsKnownFieldType(FieldDescriptorProto.Types.Type t) => Enum.IsDefined(typeof(FieldDescriptorProto.Types.Type), t);","tryCatchPattern":"try { descriptor = FieldDescriptor.FromProto(proto, parent); }\ncatch (ArgumentException ex) when (ex.Message == \"Invalid type specified\")\n{ log.LogError(\"Descriptor uses a field type unknown to this Google.Protobuf version\"); }","preventionTips":["Keep the bundled Google.Protobuf plugin version >= the protoc version that generates descriptors.","Never cast raw ints to proto enums without Enum.IsDefined checks.","Pin toolchain versions (protoc + plugin) in the build."],"tags":["protobuf","enum","descriptor-validation"],"backgroundTag":"invalid-enum-value","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"}