microsoft/semantic-kernel · error · InvalidOperationException

Topic name {topicName} is not registered as proxy publish ev

Error message

Topic name {topicName} is not registered as proxy publish event, register first before using

What it means

Thrown by ProcessProxyBuilder.LinkTopicToStepEdgeInfo when the given topicName is not found in _externalTopicUsage, meaning it was never registered as a proxy publish topic during construction. You must register a topic before linking a step edge to it.

Source

Thrown at dotnet/src/Experimental/Process.Core/ProcessProxyBuilder.cs:55

    /// </summary>
    public string Version { get; init; } = "v1";

    internal readonly Dictionary<string, bool> _externalTopicUsage;

    // For supporting multiple step edges getting linked to the same external topic, current implementation needs to be updated
    // to instead have a list of potential edges in case event names in different steps have same name
    internal readonly Dictionary<string, KernelProcessProxyEventMetadata> _eventMetadata = [];

    internal ProcessFunctionTargetBuilder GetExternalFunctionTargetBuilder()
    {
        return new ProcessFunctionTargetBuilder(this, functionName: KernelProxyStep.ProcessFunctions.EmitExternalEvent, parameterName: "proxyEvent");
    }

    internal void LinkTopicToStepEdgeInfo(string topicName, ProcessStepBuilder sourceStep, ProcessEventData eventData)
    {
        if (!this._externalTopicUsage.TryGetValue(topicName, out bool usedTopic))
        {
            throw new InvalidOperationException($"Topic name {topicName} is not registered as proxy publish event, register first before using");
        }

        if (usedTopic)
        {
            throw new InvalidOperationException($"Topic name {topicName} is is already linked to another step edge");
        }

        this._eventMetadata[eventData.EventName] = new() { EventId = eventData.EventId, TopicName = topicName };
        this._externalTopicUsage[topicName] = true;
    }

    /// <inheritdoc/>
    internal override KernelProcessStepInfo BuildStep(ProcessBuilder processBuilder, KernelProcessStepStateMetadata? stateMetadata = null)
    {
        if (this._externalTopicUsage.All(topic => !topic.Value))
        {
            throw new InvalidOperationException("Proxy step does not have linked steps to it, link step edges to proxy or remove proxy step");
        }

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Ensure the topicName passed to LinkTopicToStepEdgeInfo exactly matches one of the topics in the externalTopics list used to construct the proxy.
  2. Maintain topic names as constants or a shared configuration to avoid drift.
  3. Validate the topic exists in the proxy's registered topics before calling LinkTopicToStepEdgeInfo.

Example fix

// before
var proxy = process.AddProxyStep("myProxy", externalTopics: new[] { "topicA", "topicB" });
proxy.LinkTopicToStepEdgeInfo("topicC", sourceStep, eventData); // throws — topicC not registered

// after
proxy.LinkTopicToStepEdgeInfo("topicA", sourceStep, eventData);
Defensive patterns

Strategy: validation

Validate before calling

if (!registeredTopics.Contains(topicName))
    throw new InvalidOperationException(
        $"Topic '{topicName}' is not registered. Registered topics: {string.Join(", ", registeredTopics)}");

proxy.LinkTopicToStepEdgeInfo(topicName, sourceStep, eventData);

Prevention

When it happens

Trigger: Calling LinkTopicToStepEdgeInfo with a topicName that was not in the externalTopics list passed to the ProcessProxyBuilder constructor; typo in the topic name; using a topic from a different proxy step.

Common situations: Hardcoding topic names that drift from the ones registered at proxy construction; refactoring topic names in one place but not the other; copy-pasting proxy configuration and not updating all references.

Related errors


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