microsoft/semantic-kernel · error · KernelException
Message {messageKey} is not expected for edge group {this._e
Error message
Message {messageKey} is not expected for edge group {this._edgeGroup.GroupId}. What it means
Thrown by LocalEdgeGroupProcessor.TryGetResult when an incoming message's key (composed as '{SourceId}.{SourceEventId}') is not present in the edge group's required message sources. The edge group collects messages from multiple source steps and only fires when all declared sources have delivered their messages; this error means a message arrived from a source/event combination the group was not configured to accept.
Source
Thrown at dotnet/src/Experimental/Process.LocalRuntime/LocalEdgeGroupProcessor.cs:28
private readonly KernelProcessEdgeGroup _edgeGroup;
private readonly Dictionary<string, object?> _messageData = [];
private HashSet<string> _requiredMessages = [];
private HashSet<string> _absentMessages = [];
public LocalEdgeGroupProcessor(KernelProcessEdgeGroup edgeGroup)
{
Verify.NotNull(edgeGroup, nameof(edgeGroup));
this._edgeGroup = edgeGroup;
this.InitializeEventTracking();
}
public bool TryGetResult(ProcessMessage message, out Dictionary<string, object?>? result)
{
string messageKey = this.GetKeyForMessageSource(message);
if (!this._requiredMessages.Contains(messageKey))
{
throw new KernelException($"Message {messageKey} is not expected for edge group {this._edgeGroup.GroupId}.");
}
this._messageData[messageKey] = (message.TargetEventData as KernelProcessEventData)!.ToObject();
this._absentMessages.Remove(messageKey);
if (this._absentMessages.Count == 0)
{
// We have received all required events so forward them to the target
result = (Dictionary<string, object?>?)this._edgeGroup.InputMapping(this._messageData);
// TODO: Reset state according to configured logic i.e. reset after first message or after all messages are received.
this.InitializeEventTracking();
return true;
}
result = null;
return false;View on GitHub (pinned to c028a0c7dc)
Solutions
- Compare the message's SourceId and SourceEventId against each entry in the edge group's MessageSources (which use SourceStepId.MessageType) and correct whichever side is wrong.
- Verify that the edge defining the source-to-group routing uses the exact event id the source step emits.
- Check that the GroupId on the outgoing edges matches the group registered on the target step's IncomingEdgeGroups.
- If you renamed a step or event, update all KernelProcessEdgeGroup.MessageSources entries that reference the old names.
Example fix
// before - MessageSources references the wrong event id
group.AddEdgeSource(new KernelProcessMessageSource { SourceStepId = "MyStep", MessageType = "ProcessEventA" });
// after - corrected to match what MyStep actually emits
group.AddEdgeSource(new KernelProcessMessageSource { SourceStepId = "MyStep", MessageType = "ProcessEventB" }); Defensive patterns
Strategy: validation
Validate before calling
// Validate that each source step/event feeding an edge group is declared in the group's MessageSources
foreach (var group in step.IncomingEdgeGroups.Values)
{
foreach (var source in group.MessageSources)
{
var expectedKey = $"{source.SourceStepId}.{source.MessageType}";
// Ensure an edge exists from source.SourceStepId emitting source.MessageType into this step with this group
var matchingEdge = process.Edges
.SelectMany(kvp => kvp.Value)
.Where(e => e.Source.EventId == source.MessageType && e.OutputTarget.StepId == step.State.Id)
.Any();
if (!matchingEdge) { /* log or throw configuration error */ }
}
} Prevention
- After building the process, iterate all edge groups and verify every MessageSource has a corresponding edge.
- Use a process-builder validation pass before StartAsync to catch source/event mismatches early.
- Keep step ids and event ids stable across refactors; update edge group definitions when renaming.
When it happens
Trigger: A ProcessMessage is routed to a step whose KernelProcessEdgeGroup is registered, but the message's SourceId + SourceEventId pair does not match any KernelProcessMessageSource declared in the group's MessageSources list. This occurs when an edge connects a source step to a grouped target but the source's event id or step id does not align with what the group expects.
Common situations: Renaming a step or event id without updating the edge group's MessageSources; wiring an edge to a grouped input using the wrong event id; version changes where the emitted event id changed but the group definition was not migrated; a message from an unrelated source step accidentally sharing the same GroupId.
Related errors
- Step {this.Name} received message from Step named '{message.
- The proxy step can only handle 1 parameter object
- External message channel not configured for step with topic
- External message channel not configured for step
- The process must have an Id set
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/60e8013015e66396.
Report an issue: GitHub.