{"record":{"id":"aa333c782ca2af69","repo":"microsoft/aspire","slug":"connector-operation-operation-name-is-configured-more-than","errorCode":null,"errorMessage":"Connector operation '{operation.Name}' is configured more than once.","messagePattern":"Connector operation '(.+?)' is configured more than once\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.ConnectorNamespace/AzureConnectorNamespaceExtensions.cs","lineNumber":630,"sourceCode":"        }\n\n        var operationNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\n        var connectorDefinition = new AzureConnectorNamespaceMcpConnectorDefinition(\n            connectorName,\n            options.DisplayName,\n            options.Description,\n            connection.Resource);\n        foreach (var operation in options.Operations)\n        {\n            if (operation is null)\n            {\n                throw new ArgumentException(\"Connector operations cannot contain null values.\", nameof(options));\n            }\n\n            ArgumentException.ThrowIfNullOrWhiteSpace(operation.Name);\n            if (!operationNames.Add(operation.Name))\n            {\n                throw new ArgumentException(\n                    $\"Connector operation '{operation.Name}' is configured more than once.\",\n                    nameof(options));\n            }\n\n            connectorDefinition.Operations.Add(new AzureConnectorNamespaceMcpOperationDefinition(\n                operation.Name,\n                operation.DisplayName,\n                operation.Description));\n        }\n\n        builder.Resource.Connectors.Add(connectorDefinition);\n        return builder;\n    }\n\n    private static BicepValue<string> GetOptionalIdentityProperty(ConnectorGateway gateway, string propertyName)\n    {\n        // Existing namespaces can have no identity or a user-assigned-only identity. Safe member access\n        // preserves available system-assigned values without making output evaluation fail when absent.","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.ConnectorNamespace/AzureConnectorNamespaceExtensions.cs#L612-L648","documentation":"Each connector operation must have a unique name (compared case-insensitively via a HashSet). WithConnector throws this ArgumentException when two operations in options.Operations share the same name, since duplicate names would produce conflicting MCP operation definitions.","triggerScenarios":"Calling WithConnector with two operations whose Name values match ignoring case, e.g. \"GetItem\" and \"getitem\" in the same Operations array.","commonSituations":"Merging operation lists from multiple sources without deduplicating; copy-pasting an operation entry and changing only its parameters; case differences hiding duplicates during review.","solutions":["Rename one of the duplicate operations so every Name is unique (case-insensitively).","Deduplicate the list before calling WithConnector, e.g. GroupBy(op => op.Name, StringComparer.OrdinalIgnoreCase).First().","Centralize operation definitions so the same operation is not added twice."],"exampleFix":"// before\nOperations = new[]\n{\n    new AzureConnectorNamespaceConnectorOperation { Name = \"GetItem\" },\n    new AzureConnectorNamespaceConnectorOperation { Name = \"getitem\" }\n}\n// after\nOperations = new[]\n{\n    new AzureConnectorNamespaceConnectorOperation { Name = \"GetItem\" },\n    new AzureConnectorNamespaceConnectorOperation { Name = \"GetItemDetails\" }\n}","handlingStrategy":"validation","validationCode":"var dupes = options.Operations\n    .GroupBy(op => op.Name, StringComparer.OrdinalIgnoreCase)\n    .Where(g => g.Count() > 1)\n    .Select(g => g.Key).ToList();\nif (dupes.Count > 0) throw new InvalidOperationException($\"Duplicate operation names: {string.Join(\", \", dupes)}\");","typeGuard":null,"tryCatchPattern":"try { builder.WithConnector(options); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"more than once\"))\n{\n    // deduplicate operations and retry\n}","preventionTips":["Deduplicate by name (ignore case) before configuring.","Keep a single source of truth for operation definitions.","Watch for case-only duplicates when merging lists."],"tags":["azure","connector","duplicate","argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}