microsoft/aspire · error · InvalidOperationException

The property ' ' is not supported for the endpoint ' '.

Error message

The property '{property}' is not supported for the endpoint '{endpoint.Name}'.

What it means

GetEndpointPropertyExpression maps an EndpointProperty enum to a ReferenceExpression for compute-environment resources (e.g. container apps). The switch's default arm throws InvalidOperationException when the requested property has no mapping for the given endpoint, meaning the property is not supported on that endpoint/resource combination.

Solutions

  1. Only request EndpointProperty members your compute environment supports; guard unknown properties before calling.
  2. Update the Aspire.Hosting packages so the resource's implementation handles the enum member being requested.
  3. Add a case to the switch in a custom IComputeEnvironmentResource implementation for the unsupported property.
  4. Catch InvalidOperationException at manifest-generation time and fall back to an explicit value or skip the property.

Example fix

// before
var expr = envResource.GetEndpointPropertyExpression(endpoint, EndpointProperty.Host); // unsupported for this env
// after
if (endpoint.IsExternal || /* property supported for this env */ true)
{
    var expr = envResource.GetEndpointPropertyExpression(endpoint, supportedProperty);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// only request supported properties
static bool IsSupported(EndpointProperty p) => p is
    EndpointProperty.Host or EndpointProperty.Port or EndpointProperty.TargetPort or
    EndpointProperty.Scheme or EndpointProperty.HostAndPort or EndpointProperty.TlsEnabled;

Try / catch

try
{
    var expr = env.GetEndpointPropertyExpression(endpoint, property);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("is not supported for the endpoint"))
{
    // skip the property or emit a literal value in the manifest
}

Prevention

When it happens

Trigger: Calling the extension that builds an endpoint property expression (GetEndpointProperty overloads on IComputeEnvironmentResource) with an EndpointProperty value the implementation does not handle for the endpoint — typically newer enum members like IsExternal or Tls variants evaluated against endpoints/resources lacking that state.

Common situations: Version skew: custom environment resource or older integration compiled against fewer EndpointProperty members while a newer core enum value is requested; hand-writing manifest generation code that requests an exotic property.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs:64

        var endpoint = endpointReference.EndpointAnnotation;
        var scheme = endpoint.UriScheme;
        var port = endpoint.Port ?? GetDefaultPort(scheme, endpoint);
        var host = new Lazy<ReferenceExpression>(() => GetHostAddressExpression(endpointReference));

        return property switch
        {
            EndpointProperty.Url => IsDefaultPort(scheme, port)
                ? ReferenceExpression.Create($"{scheme}://{host.Value}")
                : ReferenceExpression.Create($"{scheme}://{host.Value}:{port.ToString(CultureInfo.InvariantCulture)}"),
            EndpointProperty.Host or EndpointProperty.IPV4Host => host.Value,
            EndpointProperty.Port => ReferenceExpression.Create($"{port.ToString(CultureInfo.InvariantCulture)}"),
            EndpointProperty.TargetPort => endpoint.TargetPort is int targetPort
                ? ReferenceExpression.Create($"{targetPort.ToString(CultureInfo.InvariantCulture)}")
                : ReferenceExpression.Create($"{new ContainerPortReference(endpointReference.Resource)}"),
            EndpointProperty.Scheme => ReferenceExpression.Create($"{scheme}"),
            EndpointProperty.HostAndPort => ReferenceExpression.Create($"{host.Value}:{port.ToString(CultureInfo.InvariantCulture)}"),
            EndpointProperty.TlsEnabled => ReferenceExpression.Create($"{(endpoint.TlsEnabled ? bool.TrueString : bool.FalseString)}"),
            _ => throw new InvalidOperationException($"The property '{property}' is not supported for the endpoint '{endpoint.Name}'.")
        };
    }

    private static int GetDefaultPort(string scheme, EndpointAnnotation endpoint)
    {
        if (string.Equals(scheme, "http", StringComparison.OrdinalIgnoreCase))
        {
            return 80;
        }

        if (string.Equals(scheme, "https", StringComparison.OrdinalIgnoreCase))
        {
            return 443;
        }

        throw new InvalidOperationException($"Endpoint '{endpoint.Name}' must specify a port for scheme '{scheme}'.");
    }

View on GitHub (pinned to 25830f84bd)