microsoft/semantic-kernel · error · KernelException

Unable to read state from process with name

Error message

Unable to read state from process with name '{this.State.Name}' and Id '{this.State.Id}'.

What it means

Thrown when reconstructing a KernelProcess from a DaprProcessInfo whose State is not a KernelProcessState. The top-level process object must carry a KernelProcessState; a different concrete state type signals schema or serialization drift.

Solutions

  1. Align the Semantic Kernel version used to read the process with the version that wrote it.
  2. Verify JSON polymorphism / $type discriminators are configured so State deserializes as KernelProcessState for processes.
  3. Inspect the persisted actor state for the process to confirm the State payload shape.
  4. Clear and re-initialize the affected process instance if state was corrupted.
Defensive patterns

Strategy: validation

Validate before calling

if (daprProcessInfo.State is not KernelProcessState)
{
    throw new InvalidOperationException($"Expected KernelProcessState but got {daprProcessInfo.State.GetType()}.");
}

Type guard

public static bool IsValidProcessState(DaprProcessInfo info) =>
    info.State is KernelProcessState;

Try / catch

try
{
    var process = daprProcessInfo.ToKernelProcess();
}
catch (KernelException ex) when (ex.Message.Contains("Unable to read state from process"))
{
    _logger.LogError(ex, "Process state schema mismatch; check version compatibility.");
    throw;
}

Prevention

When it happens

Trigger: DaprProcessInfo.ToKernelProcess() checks `this.State is KernelProcessState` and fails when the deserialized State is some other KernelProcessStepState subtype.

Common situations: Runtime version mismatch between the process that persisted state to Dapr and the runtime reading it, or a corrupted/partially-written actor state entry. Also possible after refactors that changed the state class hierarchy.

Related errors


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

Appendix: source

Thrown at dotnet/src/Experimental/Process.Runtime.Dapr/DaprProcessInfo.cs:33

[KnownType(typeof(KernelProcessStepState<>))]
public sealed record DaprProcessInfo : DaprStepInfo
{
    /// <summary>
    /// The collection of Steps in the Process.
    /// </summary>
    public required IList<DaprStepInfo> Steps { get; init; }

    /// <summary>
    /// Initializes a new instance of the <see cref="KernelProcess"/> class from this instance of <see cref="DaprProcessInfo"/>.
    /// </summary>
    /// <returns>An instance of <see cref="KernelProcess"/></returns>
    /// <exception cref="KernelException"></exception>
    public KernelProcess ToKernelProcess()
    {
        var processStepInfo = this.ToKernelProcessStepInfo();
        if (this.State is not KernelProcessState state)
        {
            throw new KernelException($"Unable to read state from process with name '{this.State.Name}' and Id '{this.State.Id}'.");
        }

        List<KernelProcessStepInfo> steps = [];
        foreach (var step in this.Steps)
        {
            if (step is DaprProcessInfo processStep)
            {
                steps.Add(processStep.ToKernelProcess());
            }
            else if (step is DaprMapInfo mapStep)
            {
                steps.Add(mapStep.ToKernelProcessMap());
            }
            else if (step is DaprProxyInfo proxyStep)
            {
                steps.Add(proxyStep.ToKernelProcessProxy());
            }
            else

View on GitHub (pinned to c028a0c7dc)