{"record":{"id":"cb21f219a1fd9145","repo":"microsoft/aspire","slug":"endpoint-option-endpoint-name-is-configured-more-than-once","errorCode":null,"errorMessage":"Endpoint option '{endpoint.Name}' is configured more than once.","messagePattern":"Endpoint option '(.+?)' is configured more than once\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxesExtensions.cs","lineNumber":413,"sourceCode":"            return;\n        }\n\n        var names = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\n        foreach (var endpoint in options.Endpoints)\n        {\n            if (endpoint is null)\n            {\n                throw new ArgumentException(\"Endpoint options cannot contain null values.\", nameof(options));\n            }\n\n            if (string.IsNullOrWhiteSpace(endpoint.Name))\n            {\n                throw new ArgumentException(\"Endpoint option names cannot be empty.\", nameof(options));\n            }\n\n            if (!names.Add(endpoint.Name))\n            {\n                throw new ArgumentException($\"Endpoint option '{endpoint.Name}' is configured more than once.\", nameof(options));\n            }\n        }\n    }\n\n    private static void ValidateOptionalWholeSecondDuration(TimeSpan? value, string paramName, TimeSpan? maximum = null)\n    {\n        if (value is null)\n        {\n            return;\n        }\n\n        if (value < TimeSpan.Zero)\n        {\n            throw new ArgumentOutOfRangeException(paramName, \"The value cannot be negative.\");\n        }\n\n        if (value.Value.Ticks % TimeSpan.TicksPerSecond != 0)\n        {","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxesExtensions.cs#L395-L431","documentation":"Endpoint option names within one AzureSandboxOptions set must be unique (compared case-insensitively). A duplicate name is ambiguous when generating Azure sandbox endpoint resources, so ValidateSandboxOptions throws when the same name is added twice.","triggerScenarios":"PublishAsAzureSandbox called with two endpoints in options.Endpoints whose Name values match case-insensitively, e.g. \"https\" and \"HTTPS\".","commonSituations":"Merging endpoint lists from multiple sources without deduplicating; adding the same endpoint descriptor twice via a loop; case differences hiding a duplicate when names come from config.","solutions":["Deduplicate options.Endpoints by Name (OrdinalIgnoreCase) before calling PublishAsAzureSandbox","Rename one of the conflicting endpoints to a distinct name","Normalize name casing at construction time so duplicates are obvious"],"exampleFix":"// before\noptions.Endpoints = [new EndpointOptions { Name = \"https\" }, new EndpointOptions { Name = \"HTTPS\" }];\n// after\noptions.Endpoints = [new EndpointOptions { Name = \"https\" }, new EndpointOptions { Name = \"https-admin\" }];","handlingStrategy":"validation","validationCode":"var dupes = options.Endpoints.GroupBy(e => e.Name, StringComparer.OrdinalIgnoreCase).Where(g => g.Count() > 1).ToList();\nif (dupes.Count > 0) throw new ArgumentException($\"Duplicate endpoint names: {string.Join(\",\", dupes.Select(d => d.Key))}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate endpoint lists by name when merging sources","Normalize endpoint name casing at construction","Keep a single source of truth for endpoint definitions"],"tags":["validation","arguments","azure-sandbox","endpoints","duplicate"],"backgroundTag":"conflicting-config-options","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"}