{"record":{"id":"fe57d863bd0df220","repo":"microsoft/semantic-kernel","slug":"topic-names-registered-must-be-different","errorCode":null,"errorMessage":"Topic names registered must be different","messagePattern":"Topic names registered must be different","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessProxyBuilder.cs","lineNumber":31,"sourceCode":"/// process.\n/// </summary>\npublic sealed class ProcessProxyBuilder : ProcessStepBuilder<KernelProxyStep>\n{\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"ProcessProxyBuilder\"/> class.\n    /// </summary>\n    internal ProcessProxyBuilder(IReadOnlyList<string> externalTopics, string name, ProcessBuilder? processBuilder)\n        : base(name, processBuilder)\n    {\n        if (externalTopics.Count == 0)\n        {\n            throw new ArgumentException(\"No topic names registered\");\n        }\n\n        this._externalTopicUsage = externalTopics.ToDictionary(topic => topic, topic => false);\n        if (this._externalTopicUsage.Count < externalTopics.Count)\n        {\n            throw new ArgumentException(\"Topic names registered must be different\");\n        }\n    }\n\n    /// <summary>\n    /// Version of the proxy step, used when saving the state of the step.\n    /// </summary>\n    public string Version { get; init; } = \"v1\";\n\n    internal readonly Dictionary<string, bool> _externalTopicUsage;\n\n    // For supporting multiple step edges getting linked to the same external topic, current implementation needs to be updated\n    // to instead have a list of potential edges in case event names in different steps have same name\n    internal readonly Dictionary<string, KernelProcessProxyEventMetadata> _eventMetadata = [];\n\n    internal ProcessFunctionTargetBuilder GetExternalFunctionTargetBuilder()\n    {\n        return new ProcessFunctionTargetBuilder(this, functionName: KernelProxyStep.ProcessFunctions.EmitExternalEvent, parameterName: \"proxyEvent\");\n    }","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessProxyBuilder.cs#L13-L49","documentation":"Thrown by the ProcessProxyBuilder constructor when the externalTopics list contains duplicate entries. After converting the list to a dictionary, if the dictionary has fewer entries than the list, duplicates were present. Each topic must be unique.","triggerScenarios":"Calling AddProxyStep with an externalTopics list containing duplicate strings, e.g. [\"topic1\", \"topic1\", \"topic2\"]. The ToDictionary call deduplicates, and the count check detects the discrepancy.","commonSituations":"Building topics from multiple configuration sources that overlap; merging topic lists without deduplication; copy-paste errors that repeat a topic name; dynamic topic generation that can produce duplicates.","solutions":["Deduplicate the topics list before passing it: externalTopics.Distinct().ToList().","Review the configuration or data source that generates the topics list to eliminate duplicates at the source.","Add a unit test that asserts topic uniqueness before calling AddProxyStep."],"exampleFix":"// before\nvar topics = new List<string> { \"topic1\", \"topic1\", \"topic2\" };\nprocess.AddProxyStep(\"myProxy\", topics); // throws\n\n// after\ntopics = topics.Distinct().ToList();\nprocess.AddProxyStep(\"myProxy\", topics);","handlingStrategy":"validation","validationCode":"if (externalTopics.Count != externalTopics.Distinct().Count())\n    throw new ArgumentException(\"Duplicate topic names detected. All topics must be unique.\", nameof(externalTopics));\n\nprocess.AddProxyStep(\"myProxy\", externalTopics);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate topic lists with .Distinct() before passing to AddProxyStep.","Use a HashSet<string> when building topic lists to prevent duplicates.","Add a unit test asserting topic uniqueness for proxy construction."],"tags":["proxy-step","validation","duplicate-detection","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}