dotnet/yarp · error · InvalidOperationException
is missing.
Error message
{typeof(IHttpSysRequestDelegationFeature).FullName} is missing. What it means
Thrown by HttpSysDelegator.DelegateRequest when the per-request IHttpSysRequestDelegationFeature is not present on the HttpContext features. This feature is supplied by the Http.sys server per connection; its absence means the request is not running on Http.sys or the feature was stripped. The delegator cannot forward the request to an Http.sys queue without it.
Solutions
- Ensure the application is hosted on Http.sys (UseHttpSys) so IHttpSysRequestDelegationFeature is populated.
- Confirm UseHttpSysDelegation is only in the pipeline when Http.sys is the server.
- Add a server-feature guard before calling DelegateRequest to skip non-Http.sys requests.
Example fix
// before
_delegator.DelegateRequest(context, destination); // throws if feature missing
// after
if (context.Features.Get<IHttpSysRequestDelegationFeature>() is { } feat && feat.CanDelegate)
{
_delegator.DelegateRequest(context, destination);
}
else
{
// fall back to normal proxying or 503
} Defensive patterns
Strategy: type-guard
Validate before calling
var feat = context.Features.Get<IHttpSysRequestDelegationFeature>();
if (feat is null)
{
context.Response.StatusCode = 503;
return;
} Type guard
static bool HasRequestDelegationFeature(HttpContext ctx) =>
ctx.Features.Get<IHttpSysRequestDelegationFeature>() is not null; Try / catch
try { _delegator.DelegateRequest(context, destination); }
catch (InvalidOperationException ex) when (ex.Message.Contains("is missing"))
{ context.Response.StatusCode = 503; await context.Response.WriteAsync("Delegation unavailable"); } Prevention
- Check IHttpSysRequestDelegationFeature before delegating.
- Run delegation logic only within an Http.sys-hosted pipeline.
- Provide a fallback (503 or normal proxy) when the feature is absent.
When it happens
Trigger: DelegateRequest is invoked for a request that is not handled by the Http.sys server, or where the delegation feature was not initialized for that connection. This can happen if delegation middleware runs for a non-Http.sys pipeline.
Common situations: Mixing Kestrel-hosted requests with HttpSysDelegator. A misconfigured pipeline where delegation logic runs for requests not backed by Http.sys. Feature removed by another middleware.
Related errors
- Current request can't be delegated. Either the request body…
- is not available. Http.sys delegation is only supported…
- Chosen destination has no model set
- Failed to resolve host
- No was found for the id ' '.
AI-assisted analysis of dotnet/yarp@bd11867bee (2026-08-13).
Data as JSON: /api/errors/c67b6b59ff446767.
Report an issue: GitHub.
Appendix: source
Thrown at src/ReverseProxy/Delegation/HttpSysDelegator.cs:63
{
if (_serverDelegationFeature is not null)
{
var key = new QueueKey(queueName, urlPrefix);
if (_queues.TryGetValue(key, out var queueWeakRef) && queueWeakRef.TryGetTarget(out var queue))
{
var detachedQueueState = queue.Detach();
Log.QueueReset(_logger, queueName, urlPrefix, detachedQueueState);
}
}
}
public void DelegateRequest(HttpContext context, DestinationState destination)
{
ArgumentNullException.ThrowIfNull(context);
ArgumentNullException.ThrowIfNull(destination);
var requestDelegationFeature = context.Features.Get<IHttpSysRequestDelegationFeature>()
?? throw new InvalidOperationException($"{typeof(IHttpSysRequestDelegationFeature).FullName} is missing.");
if (!requestDelegationFeature.CanDelegate)
{
throw new InvalidOperationException(
"Current request can't be delegated. Either the request body has started to be read or the response has started to be sent.");
}
if (_serverDelegationFeature is null || !_queuesPerDestination.TryGetValue(destination, out var queue))
{
Log.QueueNotFound(_logger, destination);
context.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
context.Features.Set<IForwarderErrorFeature>(new ForwarderErrorFeature(ForwarderError.NoAvailableDestinations, ex: null));
return;
}
Delegate(context, destination, _serverDelegationFeature, requestDelegationFeature, queue, _logger, shouldRetry: true);
static void Delegate(View on GitHub (pinned to bd11867bee)