microsoft/aspire · error · ArgumentException

Endpoint option ' ' is configured more than once.

Error message

Endpoint option '{endpoint.Name}' is configured more than once.

What it means

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.

Solutions

  1. Deduplicate options.Endpoints by Name (OrdinalIgnoreCase) before calling PublishAsAzureSandbox
  2. Rename one of the conflicting endpoints to a distinct name
  3. Normalize name casing at construction time so duplicates are obvious

Example fix

// before
options.Endpoints = [new EndpointOptions { Name = "https" }, new EndpointOptions { Name = "HTTPS" }];
// after
options.Endpoints = [new EndpointOptions { Name = "https" }, new EndpointOptions { Name = "https-admin" }];
Defensive patterns

Strategy: validation

Validate before calling

var dupes = options.Endpoints.GroupBy(e => e.Name, StringComparer.OrdinalIgnoreCase).Where(g => g.Count() > 1).ToList();
if (dupes.Count > 0) throw new ArgumentException($"Duplicate endpoint names: {string.Join(",", dupes.Select(d => d.Key))}");

Prevention

When it happens

Trigger: PublishAsAzureSandbox called with two endpoints in options.Endpoints whose Name values match case-insensitively, e.g. "https" and "HTTPS".

Common situations: 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.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/cb21f219a1fd9145. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxesExtensions.cs:413

            return;
        }

        var names = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
        foreach (var endpoint in options.Endpoints)
        {
            if (endpoint is null)
            {
                throw new ArgumentException("Endpoint options cannot contain null values.", nameof(options));
            }

            if (string.IsNullOrWhiteSpace(endpoint.Name))
            {
                throw new ArgumentException("Endpoint option names cannot be empty.", nameof(options));
            }

            if (!names.Add(endpoint.Name))
            {
                throw new ArgumentException($"Endpoint option '{endpoint.Name}' is configured more than once.", nameof(options));
            }
        }
    }

    private static void ValidateOptionalWholeSecondDuration(TimeSpan? value, string paramName, TimeSpan? maximum = null)
    {
        if (value is null)
        {
            return;
        }

        if (value < TimeSpan.Zero)
        {
            throw new ArgumentOutOfRangeException(paramName, "The value cannot be negative.");
        }

        if (value.Value.Ticks % TimeSpan.TicksPerSecond != 0)
        {

View on GitHub (pinned to 25830f84bd)