XINCGer/Unity3DTraining · error · DescriptorValidationException

"InputType" is not a message type.

Error message

"InputType" is not a message type.

What it means

During MethodDescriptor.CrossLink, the method's declared input_type is resolved through the file's DescriptorPool. If the resolved symbol exists but is not a MessageDescriptor (e.g. an enum or package), CrossLink throws DescriptorValidationException. The .proto file is structurally inconsistent for RPC use.

Solutions

  1. Fix the .proto: ensure the rpc input_type names an actual message type (fully qualified if nested).
  2. Run protoc (or protogen) to regenerate the descriptor set instead of hand-editing descriptor bytes.
  3. Rename the colliding enum/symbol so the input type name resolves to the message.

Example fix

// before (.proto)
rpc GetThing (MyEnum) returns (Thing);
// after (.proto)
rpc GetThing (GetThingRequest) returns (Thing);
Defensive patterns

Strategy: validation

Validate before calling

var sym = file.DescriptorPool.LookupSymbol(method.Proto.InputType, method);
if (!(sym is MessageDescriptor)) throw new Exception($"rpc input_type '{method.Proto.InputType}' must be a message");

Type guard

bool IsMessageType(IDescriptor d) => d is MessageDescriptor;

Try / catch

try { BuildFileDescriptor(set); } catch (DescriptorValidationException ex) { log.Error($"Invalid service descriptor: {ex.Message}"); throw; }

Prevention

When it happens

Trigger: A Service method in the .proto declares an input_type that resolves to a symbol that is not a message: wrongfully naming an enum type, a typo resolving to a different symbol, or a hand-built FileDescriptorSet where input_type points at a non-message entry.

Common situations: Generating descriptors with protoc from a .proto where an rpc input type name collides with an enum name, or building descriptor sets programmatically (e.g. for gRPC) with incorrect type names.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of XINCGer/Unity3DTraining@016f98412e (2026-09-12). Data as JSON: /api/errors/466dfe7d1628c65f. Report an issue: GitHub.

Appendix: source

Thrown at NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/MethodDescriptor.cs:91

        {
            this.proto = proto;
            service = parent;
            file.DescriptorPool.AddSymbol(this);
        }

        internal MethodDescriptorProto Proto { get { return proto; } }

        /// <summary>
        /// The brief name of the descriptor's target.
        /// </summary>
        public override string Name { get { return proto.Name; } }

        internal void CrossLink()
        {
            IDescriptor lookup = File.DescriptorPool.LookupSymbol(Proto.InputType, this);
            if (!(lookup is MessageDescriptor))
            {
                throw new DescriptorValidationException(this, "\"" + Proto.InputType + "\" is not a message type.");
            }
            inputType = (MessageDescriptor) lookup;

            lookup = File.DescriptorPool.LookupSymbol(Proto.OutputType, this);
            if (!(lookup is MessageDescriptor))
            {
                throw new DescriptorValidationException(this, "\"" + Proto.OutputType + "\" is not a message type.");
            }
            outputType = (MessageDescriptor) lookup;
        }
    }
}

View on GitHub (pinned to 016f98412e)