microsoft/semantic-kernel · error · KernelException

No '{GrpcOperation.PayloadArgumentName}' argument representi

Error message

No '{GrpcOperation.PayloadArgumentName}' argument representing gRPC request message is found for the '{operation.Name}' gRPC operation.

What it means

Thrown by GenerateOperationRequest when the arguments dictionary has no `payload` entry (GrpcOperation.PayloadArgumentName) or that entry is null/empty. The gRPC request message is built by deserializing this JSON payload string, so an absent payload means no request can be formed.

Source

Thrown at dotnet/src/Functions/Functions.Grpc/GrpcOperationRunner.cs:261

        }

        return Marshallers.Create(Serialize, Deserialize);
    }

    /// <summary>
    /// Creates a gRPC operation request.
    /// </summary>
    /// <param name="operation">The gRPC operation.</param>
    /// <param name="type">The operation request data type.</param>
    /// <param name="arguments">The operation arguments.</param>
    /// <returns>The operation request instance.</returns>
    private object GenerateOperationRequest(GrpcOperation operation, Type type, Dictionary<string, string> arguments)
    {
        //Getting 'payload' argument to by used as gRPC request message
        if (!arguments.TryGetValue(GrpcOperation.PayloadArgumentName, out string? payload) ||
            string.IsNullOrEmpty(payload))
        {
            throw new KernelException($"No '{GrpcOperation.PayloadArgumentName}' argument representing gRPC request message is found for the '{operation.Name}' gRPC operation.");
        }

        //Deserializing JSON payload to gRPC request message
        return JsonSerializer.Deserialize(payload!, type, s_propertyCaseInsensitiveOptions) ??
            throw new KernelException($"Unable to create gRPC request message for the '{operation.Name}' gRPC operation.");
    }

    /// <summary>
    /// Builds gRPC operation data contract type.
    /// </summary>
    /// <param name="dataContractMetadata">The data contract type metadata.</param>
    /// <returns>.NET type representing the data contract type.</returns>
    private static TypeInfo BuildGrpcOperationDataContractType(GrpcOperationDataContractType dataContractMetadata)
    {
        var assemblyName = new AssemblyName($"{dataContractMetadata.Name}Assembly");

        var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Provide a non-empty JSON string under the `payload` key in KernelArguments.
  2. Confirm the key name matches GrpcOperation.PayloadArgumentName (typically `payload`).
  3. Build the payload from your request object via JsonSerializer.Serialize before invoking.

Example fix

// before
await kernel.InvokeAsync(op);
// after
arguments["payload"] = "{\"id\":42}";
await kernel.InvokeAsync(op, arguments);
Defensive patterns

Strategy: validation

Validate before calling

if (!arguments.Contains(GrpcOperation.PayloadArgumentName)
    || string.IsNullOrEmpty(arguments[GrpcOperation.PayloadArgumentName]?.ToString())) {
    throw new InvalidOperationException("payload argument is required");
}

Prevention

When it happens

Trigger: Invoking a gRPC kernel function without supplying the `payload` argument, or supplying an empty string.

Common situations: Forgetting to set `arguments["payload"]`; argument key casing differs from `GrpcOperation.PayloadArgumentName`; the upstream step that was supposed to produce the JSON payload produced nothing.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/5d764e8e2aecd386. Report an issue: GitHub.