dotnet/yarp · critical · InvalidOperationException
Routing Endpoint is missing {typeof(RouteModel).FullName} me
Error message
Routing Endpoint is missing {typeof(RouteModel).FullName} metadata. What it means
After confirming an endpoint exists, the middleware expects it to carry `RouteModel` metadata — this is how YARP associates a matched endpoint with its route configuration. If the endpoint has no `RouteModel` in its metadata, the endpoint was not created by YARP's route-building process. This indicates a misconfiguration where a non-YARP endpoint (e.g., an MVC controller, a health check endpoint) is being processed by the YARP proxy pipeline.
Source
Thrown at src/ReverseProxy/Model/ProxyPipelineInitializerMiddleware.cs:42
public ProxyPipelineInitializerMiddleware(RequestDelegate next, ILogger<ProxyPipelineInitializerMiddleware> logger, IOptionsMonitor<RequestTimeoutOptions> timeoutOptions)
{
ArgumentNullException.ThrowIfNull(logger);
ArgumentNullException.ThrowIfNull(next);
ArgumentNullException.ThrowIfNull(timeoutOptions);
_logger = logger;
_next = next;
_timeoutOptions = timeoutOptions;
}
public Task Invoke(HttpContext context)
{
var endpoint = context.GetEndpoint()
?? throw new InvalidOperationException($"Routing Endpoint wasn't set for the current request.");
var route = endpoint.Metadata.GetMetadata<RouteModel>()
?? throw new InvalidOperationException($"Routing Endpoint is missing {typeof(RouteModel).FullName} metadata.");
var cluster = route.Cluster;
// TODO: Validate on load https://github.com/dotnet/yarp/issues/797
if (cluster is null)
{
Log.NoClusterFound(_logger, route.Config.RouteId);
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
return Task.CompletedTask;
}
EnsureRequestTimeoutPolicyIsAppliedCorrectly(context, endpoint, route);
var destinationsState = cluster.DestinationsState;
context.Features.Set<IReverseProxyFeature>(new ReverseProxyFeature
{
Route = route,
Cluster = cluster.Model,
AllDestinations = destinationsState.AllDestinations,View on GitHub (pinned to bd11867bee)
Solutions
- Ensure the `ProxyPipelineInitializerMiddleware` only runs for endpoints created by `MapReverseProxy` — keep non-proxy endpoints outside the proxy pipeline branch.
- If using `app.MapReverseProxy(pipeline => { ... })`, make sure only proxy-related middleware is inside that branch; register other endpoints separately in `UseEndpoints`.
- Verify that route patterns in the YARP config don't accidentally overlap with non-proxy endpoint patterns.
- Check that no global `UseMiddleware<ProxyPipelineInitializerMiddleware>()` call exists outside the proxy endpoint mapping.
Example fix
// before — health endpoint inside the proxy pipeline
app.UseEndpoints(endpoints =>
{
endpoints.MapReverseProxy(proxyPipeline =>
{
proxyPipeline.UseHealthChecks("/health"); // wrong context
proxyPipeline.RunProxy();
});
});
// after — separate endpoints
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health"); // standalone
endpoints.MapReverseProxy(); // proxy only
}); Defensive patterns
Strategy: validation
Validate before calling
// Verify the endpoint has RouteModel metadata before relying on it
var endpoint = context.GetEndpoint();
if (endpoint?.Metadata.GetMetadata<RouteModel>() is null)
{
// This endpoint was not created by YARP
context.Response.StatusCode = 404;
return;
} Type guard
static bool IsYarpEndpoint(HttpContext context)
=> context.GetEndpoint()?.Metadata.GetMetadata<RouteModel>() is not null; Try / catch
// Not applicable — this is a pipeline-configuration error. // Fix by keeping non-proxy endpoints outside the MapReverseProxy pipeline.
Prevention
- Keep health checks, metrics, and other non-proxy endpoints outside the MapReverseProxy branch.
- Use the standard endpoint registration pattern: separate MapReverseProxy() from MapHealthChecks().
- Verify that route patterns don't accidentally overlap between proxy and non-proxy endpoints.
When it happens
Trigger: `context.GetEndpoint()` returns a non-null endpoint, but `endpoint.Metadata.GetMetadata<RouteModel>()` returns null. This means the matched endpoint was registered by something other than YARP's `MapReverseProxy` (e.g., an MVC route, a health check map, a static file endpoint) but the request somehow reached the proxy initializer middleware.
Common situations: A developer accidentally wraps non-proxy endpoints inside the `MapReverseProxy` pipeline. A health check or metrics endpoint is routed through the proxy middleware. The proxy middleware is registered as a global middleware rather than scoped to the reverse-proxy endpoint group.
Related errors
- Routing Endpoint wasn't set for the current request.
- A non-empty CustomMetadata value is required
- The {typeof(IReverseProxyFeature).FullName} is missing the {
- {typeof(IReverseProxyFeature).FullName} is missing.
- The timeout was not applied for route '{route.Config.RouteId
AI-assisted analysis of dotnet/yarp@bd11867bee (2026-08-13).
Data as JSON: /api/errors/1573eda9d2056183.
Report an issue: GitHub.