{"record":{"id":"34d53a85789508cb","repo":"microsoft/semantic-kernel","slug":"unable-to-read-state-from-map-with-name-this-sta","errorCode":null,"errorMessage":"Unable to read state from map with name '{this.State.Name}' and Id '{this.State.Id}'.","messagePattern":"Unable to read state from map with name '(.+?)' and Id '(.+?)'\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Runtime.Dapr/DaprMapInfo.cs","lineNumber":30,"sourceCode":"[KnownType(typeof(KernelProcessStepState<>))]\npublic sealed record DaprMapInfo : DaprStepInfo\n{\n    /// <summary>\n    /// The map operation\n    /// </summary>\n    public required DaprStepInfo Operation { get; init; }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"KernelProcessMap\"/> class from this instance of <see cref=\"DaprMapInfo\"/>.\n    /// </summary>\n    /// <returns>An instance of <see cref=\"KernelProcessMap\"/></returns>\n    /// <exception cref=\"KernelException\"></exception>\n    public KernelProcessMap ToKernelProcessMap()\n    {\n        KernelProcessStepInfo processStepInfo = this.ToKernelProcessStepInfo();\n        if (this.State is not KernelProcessMapState state)\n        {\n            throw new KernelException($\"Unable to read state from map with name '{this.State.Name}' and Id '{this.State.Id}'.\");\n        }\n\n        KernelProcessStepInfo operationStep =\n            this.Operation is DaprProcessInfo processInfo\n                ? processInfo.ToKernelProcess()\n                : this.Operation.ToKernelProcessStepInfo();\n\n        return new KernelProcessMap(state, operationStep, this.Edges);\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"DaprMapInfo\"/> class from an instance of <see cref=\"KernelProcessMap\"/>.\n    /// </summary>\n    /// <param name=\"processMap\">The <see cref=\"KernelProcessMap\"/> used to build the <see cref=\"DaprMapInfo\"/></param>\n    /// <returns>An instance of <see cref=\"DaprProcessInfo\"/></returns>\n    public static DaprMapInfo FromKernelProcessMap(KernelProcessMap processMap)\n    {\n        Verify.NotNull(processMap);","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Runtime.Dapr/DaprMapInfo.cs#L12-L48","documentation":"Thrown when reconstructing a KernelProcessMap from a DaprMapInfo whose State is not a KernelProcessMapState. The Dapr runtime expects the persisted state for a map to be specifically a KernelProcessMapState; any other state type indicates a serialization or schema mismatch.","triggerScenarios":"DaprMapInfo.ToKernelProcessMap() checks `this.State is KernelProcessMapState` and fails. Triggered when loading a map whose state was persisted under a different schema or got deserialized into the wrong concrete state type.","commonSituations":"Version upgrades that renamed or restructured KernelProcessMapState, JSON polymorphism configuration changes, or a map definition that was persisted by a newer/older runtime version than the one reading it.","solutions":["Confirm the Semantic Kernel version persisting the process matches the version reading it back.","Check the JSON serialization settings and polymorphic type discriminators for KernelProcessMapState so the correct concrete type is materialized.","Inspect the persisted State JSON to verify it carries the expected $type / discriminator for KernelProcessMapState.","Re-persist the process with the current runtime version after migrating any state shape changes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate map state type before converting\nif (daprMapInfo.State is not KernelProcessMapState)\n{\n    throw new InvalidOperationException($\"Expected KernelProcessMapState but got {daprMapInfo.State.GetType()}.\");\n}","typeGuard":"public static bool IsValidMapState(DaprMapInfo info) =>\n    info.State is KernelProcessMapState;","tryCatchPattern":"try\n{\n    var map = daprMapInfo.ToKernelProcessMap();\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"Unable to read state from map\"))\n{\n    _logger.LogError(ex, \"Map state schema mismatch; check version compatibility.\");\n    throw;\n}","preventionTips":["Use the same Semantic Kernel version to persist and load process map state.","Verify JSON polymorphism settings for KernelProcessMapState are configured consistently.","Run integration tests that round-trip map state through Dapr."],"tags":["dapr","process-runtime","serialization","map-state","schema-mismatch"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}