XINCGer/Unity3DTraining · error · DescriptorValidationException

"OutputType" is not a message type.

Error message

"OutputType" is not a message type.

What it means

The output_type counterpart of the CrossLink check: after resolving Proto.OutputType via the DescriptorPool, the result must be a MessageDescriptor; otherwise MethodDescriptor.CrossLink throws DescriptorValidationException. Same cause as the input-type check but for the method's return type.

Solutions

  1. Fix the .proto output_type to name a real message type (use fully qualified names for nested messages).
  2. Regenerate the descriptor set with protoc after fixing the .proto.
  3. Check for symbol name collisions between the return type name and an enum/package name.

Example fix

// before (.proto)
rpc GetThing (GetThingRequest) returns (Status);
// after (.proto)
rpc GetThing (GetThingRequest) returns (GetThingResponse);
Defensive patterns

Strategy: validation

Validate before calling

var sym = file.DescriptorPool.LookupSymbol(method.Proto.OutputType, method);
if (!(sym is MessageDescriptor)) throw new Exception($"rpc output_type '{method.Proto.OutputType}' 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's output_type resolves to a non-message symbol (enum, typo'd name resolving to another kind, or a programmatically built descriptor set with a wrong output_type).

Common situations: Typing an enum as the rpc return type in a .proto, or descriptor sets generated/edited by tooling that mis-resolves the response type name.

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/3ef12fdc8002fe65. Report an issue: GitHub.

Appendix: source

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

        /// <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)