This endpoint requires a rate limiting policy with name perUser, but no such policy exists. means RequireRateLimiting("perUser") names a policy that AddRateLimiter never added. Use the name the policy was registered under, or register a policy with the name the endpoint asks for.

In this test the limiter had one policy, fixed, and the endpoint asked for perUser. Changing the endpoint to RequireRateLimiting("fixed") turned the 500 into a 200.

The error

The app started normally. The first request to the endpoint got a 500 with the Development exception page as plain text, and the server console logged the same exception at Error level (fail:):

PS> curl.exe -s -i http://127.0.0.1:15630/quote
HTTP/1.1 500 Internal Server Error
Content-Type: text/plain; charset=utf-8
Date: Sat, 14 Nov 2026 01:26:50 GMT
Server: Kestrel
Transfer-Encoding: chunked

System.InvalidOperationException: This endpoint requires a rate limiting policy with name perUser, but no such policy exists.
   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.<CreateEndpointLimiter>b__15_0(HttpContext context)
...
   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.CombinedAcquire(HttpContext context)
   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.TryAcquireAsync(HttpContext context, MetricsContext metricsContext)
   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)
...

Why it happens

The configuration that produced it:

...
builder.Services.AddRateLimiter(options =>
{
    options.RejectionStatusCode = StatusCodes.Status429TooManyRequests;
    options.AddFixedWindowLimiter("fixed", limiter =>
    {
        limiter.PermitLimit = 2;
        limiter.Window = TimeSpan.FromSeconds(30);
        limiter.QueueLimit = 0;
    });
});
...
app.MapGet("/quote", () => "Quote for Maria Garcia").RequireRateLimiting("perUser");
...

Policy names are plain strings, so nothing checks them at build time, and the app printed no warning at startup. The stack trace shows the rate limiting middleware failing when it tried to create the limiter for this endpoint, on the first request. The message prints the name it looked for (perUser) but not the names that exist, so compare it with your Add...Limiter calls by hand.

The fix

...
app.MapGet("/quote", () => "Quote for Maria Garcia").RequireRateLimiting("fixed");
...
PS> curl.exe -s -i http://127.0.0.1:15630/quote
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Date: Sat, 14 Nov 2026 01:27:33 GMT
Server: Kestrel
Transfer-Encoding: chunked

Quote for Maria Garcia

Nothing else changed between the two runs. One way to make the mistake harder to repeat, not tested here, is to keep each policy name in a constant and use it in both calls, as the authorization policy post does for policy names.

How it was reproduced

A minimal API made with dotnet new web -f net10.0 on SDK 11.0.100, running on Microsoft.AspNetCore.App 10.0.15 in the Development environment, built and started by a small script, start.ps1, which runs dotnet build -nologo -v q in the project folder and then bin\Debug\net10.0\FixLab.exe --urls http://127.0.0.1:15630. The project file references Microsoft.AspNetCore.Authentication.JwtBearer 10.0.0, shared by the other labs of this batch; no package was added for the rate limiter, and the template's log levels were unchanged. One request was sent before the fix and one after it. FixLab, port 15630, the route /quote, the policy names fixed and perUser and the patient name are the test's own.

Frequently asked

What does 'This endpoint requires a rate limiting policy with name ..., but no such policy exists' mean?
RequireRateLimiting names a policy that AddRateLimiter never added. In the test the endpoint asked for perUser while only fixed was registered, and the request got a 500.
Is the missing rate limiting policy reported at startup?
Not in the test. The app started without a warning and the exception came with the first request to the endpoint.
How do I fix a missing rate limiting policy name?
Use the exact name the policy was added under, or add a policy with the name the endpoint asks for. In the test RequireRateLimiting("fixed") returned 200.

More decoded errors in the Fixes category. If the app stops at startup on UseRateLimiter instead, see 'Unable to find the required services ... AddRateLimiter'; for the same mistake with an authorization policy, see 'The AuthorizationPolicy named ... was not found'.