{"record":{"id":"bed9356354b2b6f8","repo":"microsoft/semantic-kernel","slug":"the-target-for-the-edge-is-not-a-function-target-bed935","errorCode":null,"errorMessage":"The target for the edge is not a function target.","messagePattern":"The target for the edge is not a function target\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Runtime.Dapr/Actors/StepActor.cs","lineNumber":466,"sourceCode":"                // Emit the event to the parent process\n                IEventBuffer parentProcess = this.ProxyFactory.CreateActorProxy<IEventBuffer>(new ActorId(this.ParentProcessId), nameof(EventBufferActor));\n                await parentProcess.EnqueueAsync(daprEvent.ToJson()).ConfigureAwait(false);\n            }\n        }\n\n        if (this.EventProxyStepId != null)\n        {\n            IEventBuffer proxyBuffer = this.ProxyFactory.CreateActorProxy<IEventBuffer>(this.EventProxyStepId, nameof(EventBufferActor));\n            await proxyBuffer.EnqueueAsync(daprEvent.ToJson()).ConfigureAwait(false);\n        }\n\n        // Get the edges for the event and queue up the messages to be sent to the next steps.\n        bool foundEdge = false;\n        foreach (KernelProcessEdge edge in this.GetEdgeForEvent(daprEvent.QualifiedId))\n        {\n            if (edge.OutputTarget is not KernelProcessFunctionTarget functionTarget)\n            {\n                throw new KernelException(\"The target for the edge is not a function target.\").Log(this._logger);\n            }\n            ProcessMessage message = ProcessMessageFactory.CreateFromEdge(edge, daprEvent.SourceId, daprEvent.Data);\n            ActorId scopedStepId = this.ScopedActorId(new ActorId(functionTarget.StepId));\n            IMessageBuffer targetStep = this.ProxyFactory.CreateActorProxy<IMessageBuffer>(scopedStepId, nameof(MessageBufferActor));\n            await targetStep.EnqueueAsync(message.ToJson()).ConfigureAwait(false);\n            foundEdge = true;\n        }\n\n        // Error event was raised with no edge to handle it, send it to the global error event buffer.\n        if (!foundEdge && daprEvent.IsError && this.ParentProcessId != null)\n        {\n            IEventBuffer parentProcess1 = this.ProxyFactory.CreateActorProxy<IEventBuffer>(ProcessActor.GetScopedGlobalErrorEventBufferId(this.ParentProcessId), nameof(EventBufferActor));\n            await parentProcess1.EnqueueAsync(daprEvent.ToJson()).ConfigureAwait(false);\n        }\n    }\n\n    /// <summary>\n    /// Scopes the Id of a step within the process to the process.","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Runtime.Dapr/Actors/StepActor.cs#L448-L484","documentation":"Thrown while routing an event along a KernelProcessEdge whose OutputTarget is not a KernelProcessFunctionTarget. The Dapr StepActor only knows how to deliver messages to function targets on downstream steps; any other edge target type is unsupported and stops event routing.","triggerScenarios":"Raised in the event-handling path of StepActor when iterating GetEdgeForEvent for an incoming daprEvent and encountering an edge whose OutputTarget is a different subtype (e.g., a map/proxy target) rather than KernelProcessFunctionTarget.","commonSituations":"A process definition was built with edges pointing at non-function targets (maps, proxies, or custom edge targets), persisted, and then loaded by a Dapr runtime version that only supports function targets. Also arises from bugs in process graph construction or schema drift between definition and runtime.","solutions":["Audit the process definition's edges and ensure every OutputTarget is a KernelProcessFunctionTarget before publishing to Dapr.","Rebuild the process graph with the supported edge-target API; convert any map/proxy targets to the equivalent supported constructs.","Upgrade Process.Runtime.Dapr to a version that supports the edge target subtype you are using, or downgrade the process definition to match."],"exampleFix":"// before\nedges.Add(new KernelProcessEdge(sourceId, new SomeOtherTarget(...)));\n// after\nedges.Add(new KernelProcessEdge(sourceId,\n    new KernelProcessFunctionTarget(stepId: \"MyStep\", functionName: \"Handle\", parameterName: \"input\")));","handlingStrategy":"validation","validationCode":"// Validate all edges before publishing the process\nforeach (var edge in process.Edges.SelectMany(e => e.Value))\n{\n    if (edge.OutputTarget is not KernelProcessFunctionTarget)\n    {\n        throw new InvalidOperationException($\"Edge target {edge.OutputTarget.GetType().Name} is unsupported by the Dapr runtime.\");\n    }\n}","typeGuard":"public static bool IsFunctionTargetEdge(KernelProcessEdge edge) =>\n    edge.OutputTarget is KernelProcessFunctionTarget;","tryCatchPattern":"try\n{\n    await stepActor.HandleEventAsync(daprEvent).ConfigureAwait(false);\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"not a function target\"))\n{\n    _logger.LogError(\"Edge for event {Id} has an unsupported target type.\", daprEvent.QualifiedId);\n    throw;\n}","preventionTips":["Build process graphs only with KernelProcessFunctionTarget edges when targeting the Dapr runtime.","Add a build-time validation pass over edges before sending the process to Dapr.","Document which edge target types each runtime supports."],"tags":["dapr","process-runtime","edge-routing","event-dispatch"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}