microsoft/semantic-kernel · error · ArgumentException
Unknown type {type}
Error message
Unknown type {type} What it means
Thrown by GetNetType's switch expression when a protobuf field type enum value is not one of the recognized TYPE_* cases (DOUBLE, FLOAT, INT64, ... BYTES, etc.). The default arm raises ArgumentException naming the unrecognized type token.
Source
Thrown at dotnet/src/Functions/Functions.Grpc/GrpcOperationRunner.cs:351
private static Type GetNetType(string type) =>
type switch
{
"TYPE_DOUBLE" => typeof(double),
"TYPE_FLOAT" => typeof(float),
"TYPE_INT64" => typeof(long),
"TYPE_UINT64" => typeof(ulong),
"TYPE_INT32" => typeof(int),
"TYPE_FIXED64" => typeof(ulong),
"TYPE_FIXED32" => typeof(uint),
"TYPE_BOOL" => typeof(bool),
"TYPE_STRING" => typeof(string),
"TYPE_BYTES" => typeof(byte[]),
"TYPE_UINT32" => typeof(uint),
"TYPE_SFIXED32" => typeof(int),
"TYPE_SFIXED64" => typeof(long),
"TYPE_SINT32" => typeof(int),
"TYPE_SINT64" => typeof(long),
_ => throw new ArgumentException($"Unknown type {type}", nameof(type)),
};
}
View on GitHub (pinned to c028a0c7dc)
Solutions
- Restrict the .proto operation payload to primitive scalar types the switch handles.
- Avoid enum-typed, message-typed, or map fields in the gRPC operation contract used by this runner.
- If you need an unsupported type, pass it as a string and handle conversion yourself.
Example fix
// before // .proto field: repeated Item items = 1; (message type) // after // .proto field: string items_json = 1; (primitive)
Defensive patterns
Strategy: validation
Validate before calling
// Inspect your .proto: only use scalar types this runner maps (TYPE_STRING, TYPE_INT32, ...).
Try / catch
try { /* invoke */ }
catch (ArgumentException ex) when (ex.Message.Contains("Unknown type")) {
// a field type is unsupported; simplify the .proto
} Prevention
- Restrict operation payloads to supported protobuf scalar types.
- Avoid enum/message/map fields in runner contracts.
When it happens
Trigger: A FieldDescriptorProto.Type value outside the handled set — typically a newer protobuf type (e.g. enum-typed or message-typed fields that arrive as a Type enum the switch doesn't map) or a corrupt descriptor.
Common situations: Using complex message/enum/map fields in the .proto that the runner does not yet support; protobuf-schema features ahead of the supported set.
Related errors
- Impossible to create type for '{dataContractMetadata.Name}'
- Parsing of '{protoFileName}' .proto document has failed. Det
- No '{fullTypeName}' message type is found while resolving da
- Impossible to find protobuf type name corresponding to '{typ
- Unsupported parameter type: {typeString}
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/160f8d9ce28f19d5.
Report an issue: GitHub.