microsoft/semantic-kernel · error · KernelException

Unable to read state from proxy with name '{this.State.Name}

Error message

Unable to read state from proxy with name '{this.State.Name}', Id '{this.State.Id}' and type {this.State.GetType()}.

What it means

Thrown when reconstructing a KernelProcessProxy from a DaprProxyInfo whose State is not a KernelProcessStepState. Proxy state must deserialize to the base step state type; otherwise the runtime cannot rebuild the proxy object.

Source

Thrown at dotnet/src/Experimental/Process.Runtime.Dapr/DaprProxyInfo.cs:30

[KnownType(typeof(KernelProcessStepState<>))]
public sealed record DaprProxyInfo : DaprStepInfo
{
    /// <summary>
    /// Proxy related data to be able to emit the events externally
    /// </summary>
    public required KernelProcessProxyStateMetadata? ProxyMetadata { get; init; }

    /// <summary>
    /// Initializes a new instance of the <see cref="KernelProcessMap"/> class from this instance of <see cref="DaprMapInfo"/>.
    /// </summary>
    /// <returns>An instance of <see cref="KernelProcessMap"/></returns>
    /// <exception cref="KernelException"></exception>
    public KernelProcessProxy ToKernelProcessProxy()
    {
        KernelProcessStepInfo processStepInfo = this.ToKernelProcessStepInfo();
        if (this.State is not KernelProcessStepState state)
        {
            throw new KernelException($"Unable to read state from proxy with name '{this.State.Name}', Id '{this.State.Id}' and type {this.State.GetType()}.");
        }

        return new KernelProcessProxy(state, this.Edges)
        {
            ProxyMetadata = this.ProxyMetadata,
        };
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="DaprProxyInfo"/> class from an instance of <see cref="KernelProcessProxy"/>.
    /// </summary>
    /// <param name="kernelProxyInfo">The <see cref="KernelProcessProxy"/> used to build the <see cref="DaprProxyInfo"/></param>
    /// <returns></returns>
    public static DaprProxyInfo FromKernelProxyInfo(KernelProcessProxy kernelProxyInfo)
    {
        Verify.NotNull(kernelProxyInfo, nameof(kernelProxyInfo));

        DaprStepInfo proxyStepInfo = DaprStepInfo.FromKernelStepInfo(kernelProxyInfo);

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Check the GetType() value reported in the message to identify what concrete state type was actually deserialized.
  2. Align serialization settings and the Semantic Kernel version across persist and load.
  3. Verify the persisted JSON carries the expected state discriminator and re-persist if schema changed.
Defensive patterns

Strategy: validation

Validate before calling

if (daprProxyInfo.State is not KernelProcessStepState)
{
    throw new InvalidOperationException($"Expected KernelProcessStepState but got {daprProxyInfo.State?.GetType()}.");
}

Type guard

public static bool IsValidProxyState(DaprProxyInfo info) =>
    info.State is KernelProcessStepState;

Try / catch

try
{
    var proxy = daprProxyInfo.ToKernelProcessProxy();
}
catch (KernelException ex) when (ex.Message.Contains("Unable to read state from proxy"))
{
    _logger.LogError(ex, "Proxy state schema mismatch; actual type: see message.");
    throw;
}

Prevention

When it happens

Trigger: DaprProxyInfo.ToKernelProcessProxy() checks `this.State is KernelProcessStepState` and fails when the deserialized state is an incompatible type. Includes the actual State.GetType() in the message to aid diagnosis.

Common situations: Deserialization polymorphism misconfiguration, version drift where KernelProcessStepState was subclassed or renamed, or a proxy entry whose persisted JSON lacks the correct type discriminator.

Related errors


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