microsoft/semantic-kernel · error · KernelException
Non-string gRPC operation arguments are not supported in Rel
Error message
Non-string gRPC operation arguments are not supported in Release Candidate 1. This feature will be available soon, but for now, please ensure that all arguments are strings. Operation '{operation.Name}' argument '{item.Key}' is of type '{item.Value?.GetType()}'. What it means
Thrown by GrpcOperationRunner.CastToStringArguments when a value in the KernelArguments dictionary for a gRPC operation is not a `string`. The runner builds a `Dictionary<string,string>` and explicitly rejects non-string values, citing Release Candidate 1 limitations — this is a deliberate feature gate, not a generic type error.
Source
Thrown at dotnet/src/Functions/Functions.Grpc/GrpcOperationRunner.cs:131
}
/// <summary>
/// Casts argument values of type object to string.
/// </summary>
/// <param name="arguments">The kernel arguments to be cast.</param>
/// <param name="operation">The gRPC operation.</param>
/// <returns>A dictionary of arguments with string values.</returns>
/// <exception cref="KernelException">Thrown when an argument has an unsupported, non-string type.</exception>
private static Dictionary<string, string> CastToStringArguments(KernelArguments arguments, GrpcOperation operation)
{
return arguments.ToDictionary(item => item.Key, item =>
{
if (item.Value is string stringValue)
{
return stringValue;
}
throw new KernelException($"Non-string gRPC operation arguments are not supported in Release Candidate 1. This feature will be available soon, but for now, please ensure that all arguments are strings. Operation '{operation.Name}' argument '{item.Key}' is of type '{item.Value?.GetType()}'.");
});
}
/// <summary>
/// Converts gRPC response.
/// </summary>
/// <param name="response">The response to convert.</param>
/// <param name="responseType">The response type info.</param>
/// <returns>The converted response.</returns>
private static JsonObject ConvertResponse(object response, Type responseType)
{
var content = JsonSerializer.Serialize(response, responseType, s_camelCaseOptions);
//First iteration allowing to associate additional metadata with the returned content.
var result = new JsonObject
{
{ "content", content },
{ "contentType", "application/json; charset=utf-8" }View on GitHub (pinned to c028a0c7dc)
Solutions
- Convert every argument value to string before invocation: `arguments[k] = value?.ToString()`.
- Build KernelArguments with string values from the start for gRPC operations.
- Check each value's type in a loop and stringify non-strings.
Example fix
// before arguments["limit"] = 10; await kernel.InvokeAsync(grpcPlugin["search"]); // after arguments["limit"] = "10"; await kernel.InvokeAsync(grpcPlugin["search"]);
Defensive patterns
Strategy: validation
Validate before calling
// Stringify all arguments before invoking a gRPC operation:
foreach (var k in arguments.Names.ToList()) {
if (arguments[k] is not string)
arguments[k] = arguments[k]?.ToString() ?? string.Empty;
} Prevention
- Treat gRPC operation arguments as string-only by convention.
- Add a wrapper that converts KernelArguments for gRPC plugins.
When it happens
Trigger: Supplying KernelArguments where one entry is an int, bool, object, etc., e.g. `arguments["count"] = 5` instead of `"5"`, for any argument of a registered gRPC operation.
Common situations: Reusing arguments built for a native kernel function (which accept objects) with a gRPC plugin; reading args from JSON deserialization that produced typed values.
Related errors
- Invalid argument type for function {functionMetadata.Name}.
- No '{GrpcOperation.PayloadArgumentName}' argument representi
- Unable to create gRPC request message for the '{operation.Na
- The option key '{key}' value must be of type '{typeof(T)}' b
- The provided audio options '{executionSettings.Audio?.GetTyp
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/2bb4e17c1cb62555.
Report an issue: GitHub.