microsoft/semantic-kernel · error · KernelException
The process named '{this.Name}' does not expose an event wit
Error message
The process named '{this.Name}' does not expose an event with Id '{eventId}'. What it means
Thrown by ProcessBuilder.WhereInputEventIs when the given eventId is not found in the process's _externalEventTargetMap. This means the process has no step registered to receive an external event with that Id, so no target can be resolved.
Source
Thrown at dotnet/src/Experimental/Process.Core/ProcessBuilder.cs:500
/// <returns></returns>
internal ListenForBuilder ListenFor()
{
return new ListenForBuilder(this);
}
/// <summary>
/// Retrieves the target for a given external event. The step associated with the target is the process itself (this).
/// </summary>
/// <param name="eventId">The Id of the event</param>
/// <returns>An instance of <see cref="ProcessFunctionTargetBuilder"/></returns>
/// <exception cref="KernelException"></exception>
public ProcessFunctionTargetBuilder WhereInputEventIs(string eventId)
{
Verify.NotNullOrWhiteSpace(eventId, nameof(eventId));
if (!this._externalEventTargetMap.TryGetValue(eventId, out var target))
{
throw new KernelException($"The process named '{this.Name}' does not expose an event with Id '{eventId}'.");
}
if (target is not ProcessFunctionTargetBuilder functionTargetBuilder)
{
throw new KernelException($"The process named '{this.Name}' does not expose an event with Id '{eventId}'.");
}
// Targets for external events on a process should be scoped to the process itself rather than the step inside the process.
var processTarget = functionTargetBuilder with { Step = this, TargetEventId = eventId };
return processTarget;
}
/// <summary>
/// Builds the process.
/// </summary>
/// <returns>An instance of <see cref="KernelProcess"/></returns>
public KernelProcess Build(KernelProcessStateMetadata? stateMetadata = null)
{View on GitHub (pinned to c028a0c7dc)
Solutions
- Ensure a step in the process has been wired to handle the event using process.OnInputEvent(eventId).SendEventTo(target) before calling WhereInputEventIs.
- Verify the eventId string exactly matches the one used when registering the input event (case-sensitive).
- Check that the step targeted by the event is added to the process before WhereInputEventIs is called.
Example fix
// before
var target = process.WhereInputEventIs("StartEvent"); // throws if no step registered for StartEvent
// after — register the edge first
process.OnInputEvent("StartEvent").SendEventTo(myStep.WhereInputEventIs("input"));
var target = process.WhereInputEventIs("StartEvent"); Defensive patterns
Strategy: validation
Validate before calling
var registeredEvents = process.GetExternalEvents(); // hypothetical or reflection
if (!registeredEvents.Contains(eventId))
throw new InvalidOperationException(
$"Event '{eventId}' is not registered. Call process.OnInputEvent(\"{eventId}\").SendEventTo(...) first.");
var target = process.WhereInputEventIs(eventId); Try / catch
try
{
var target = process.WhereInputEventIs(eventId);
}
catch (KernelException ex) when (ex.Message.Contains("does not expose an event"))
{
// Handle: event not registered — log and register or skip
logger.LogWarning("External event {EventId} not found on process", eventId);
} Prevention
- Register all external events (OnInputEvent + SendEventTo) before calling WhereInputEventIs.
- Keep event Ids in constants to avoid typos and drift.
- Build the complete edge graph before querying event targets.
When it happens
Trigger: Calling process.WhereInputEventIs("myEvent") before any step has been wired to respond to that event via OnInputEvent; using an event Id that was never registered; misspelling the event Id; calling WhereInputEventIs on a freshly constructed process with no edges defined.
Common situations: Defining a process and trying to reference an external event before building the edge graph; event Id mismatch between the publisher and the process definition; refactoring step names or event Ids and forgetting to update the external event reference.
Related errors
- Unsupported thread type: {typeof(T).Name}
- Map operation is not a process.
- Entry agent is not defined.
- Unable to transform output to {typeof(TOutput)}.
- Unable to transform result into {typeof(TOutput).Name}
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/e0a0de8ec6c5d693.
Report an issue: GitHub.