{"record":{"id":"138fbd62e475dabb","repo":"microsoft/aspire","slug":"invalid-value-configuredrange-for-knownconfignames","errorCode":null,"errorMessage":"Invalid value \"{configuredRange}\" for \"{KnownConfigNames.ProxylessEndpointPortRange}\". Expected a port range formatted as \"start-end\", for example \"10000-32767\".","messagePattern":"Invalid value \"(.+?)\" for \"(.+?)\"\\. Expected a port range formatted as \"start-end\", for example \"10000-32767\"\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/DcpOptions.cs","lineNumber":386,"sourceCode":"        var endText = configuredRange[(separatorIndex + 1)..].Trim();\n        if (!int.TryParse(startText, NumberStyles.None, CultureInfo.InvariantCulture, out var start))\n        {\n            ThrowInvalidProxylessEndpointPortRange(configuredRange);\n        }\n\n        if (!int.TryParse(endText, NumberStyles.None, CultureInfo.InvariantCulture, out var end))\n        {\n            ThrowInvalidProxylessEndpointPortRange(configuredRange);\n        }\n\n        options.ProxylessEndpointPortRangeStart = start;\n        options.ProxylessEndpointPortRangeEnd = end;\n    }\n\n    [DoesNotReturn]\n    private static void ThrowInvalidProxylessEndpointPortRange(string configuredRange)\n    {\n        throw new InvalidOperationException(\n            $\"Invalid value \\\"{configuredRange}\\\" for \\\"{KnownConfigNames.ProxylessEndpointPortRange}\\\". Expected a port range formatted as \\\"start-end\\\", for example \\\"10000-32767\\\".\");\n    }\n\n    private static string? GetMetadataValue(IEnumerable<AssemblyMetadataAttribute>? assemblyMetadata, string key)\n    {\n        return assemblyMetadata?.FirstOrDefault(m => string.Equals(m.Key, key, StringComparison.OrdinalIgnoreCase))?.Value;\n    }\n}\n","sourceCodeStart":368,"sourceCodeEnd":395,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/DcpOptions.cs#L368-L395","documentation":"The ProxylessEndpointPortRange configuration must be formatted as \"start-end\" (two integers separated by a hyphen). When the configured string does not match this format, ApplyProxylessEndpointPortRangeOverride calls this dedicated throw helper producing an InvalidOperationException. It fails fast so an unparseable port range never reaches DCP endpoint allocation.","triggerScenarios":"Setting the KnownConfigNames.ProxylessEndpointPortRange config key (e.g. ASPNETCORE or aspire proxyless endpoint env var) to something like \"10000\", \"10000..32767\", \"32767-10000\" (reversed if validation rejects), or arbitrary text.","commonSituations":"Typos when constraining the ephemeral port range for proxyless endpoints; copying a range syntax from another tool (e.g., Docker's or Hyper-V's syntax); forgetting the hyphen separator.","solutions":["Set the value to \"start-end\" format with two integers, e.g. \"10000-32767\"","Ensure start <= end and ports are within valid range (1-65535)","Remove the setting to use the default port range"],"exampleFix":"// before (appsettings/env)\n\"Aspire:Dcp:ProxylessEndpointPortRange\": \"10000..32767\"\n// after\n\"Aspire:Dcp:ProxylessEndpointPortRange\": \"10000-32767\"","handlingStrategy":"validation","validationCode":"var range = configuration[KnownConfigNames.ProxylessEndpointPortRange];\nif (range is not null)\n{\n    var parts = range.Split('-');\n    if (parts.Length != 2 || !int.TryParse(parts[0], out var s) || !int.TryParse(parts[1], out var e) || s > e || s < 1 || e > 65535)\n        throw new FormatException($\"Invalid port range '{range}'. Expected 'start-end', e.g. 10000-32767.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    dcpOptions.Configure(configuration);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"start-end\"))\n{\n    // Remove/fix the ProxylessEndpointPortRange setting and retry with defaults.\n}","preventionTips":["Use strict \"start-end\" syntax with a hyphen when setting the port range","Validate start <= end and the 1-65535 bounds before setting","Do not copy range syntax from other tooling (Docker, Hyper-V)"],"tags":["configuration","ports","format","dcp"],"backgroundTag":"invalid-argument-format","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}