Skip to content

HTTP status code · Server errors (5xx)

501 Not Implemented

501 Not Implemented means the server does not support the functionality the request needs, typically an HTTP method it does not recognize for any URL. The most common cause is a client sending a method such as PATCH, PROPFIND or a custom verb to a server that never implemented it.

Facts about this status code
Class5xx, Server errors
Defined inRFC 9110 §15.6.2
Cacheable by defaultYes, heuristically cacheable; one of the few 5xx codes RFC 9110 lets caches reuse without explicit headers
Safe to retryNo; the server lacks the feature, so only a different method or encoding helps
Relevant headers
  • Transfer-Encoding: an unknown transfer coding in the request is the other standard trigger for 501 (RFC 9112, section 6.1)

What 501 means

RFC 9110, section 15.6.2, says 501 is the appropriate response when the server does not recognize the request method and cannot support it for any resource. That scope is the key difference from 405 Method Not Allowed, which says this particular URL refuses a method that other URLs on the same server may accept.

The other place 501 shows up is at the protocol layer. RFC 9112 tells servers to answer 501 when a request uses a transfer coding they do not understand, and Go's net/http does exactly that, replying "501 Not Implemented" with the body "Unsupported transfer encoding" before your handler runs.

It is also one of the few server errors that RFC 9110 marks as heuristically cacheable, because the missing feature will not appear on the next request.

When to use it

  • A method your server does not implement anywhere, for example a WebDAV verb sent to a plain REST API.
  • A stub endpoint for a feature that is planned but not built yet, when you want clients to see "server limitation" rather than "your request is wrong".

Common causes

If you are visiting the site

  • Rare in a browser. You usually see it through a tool or app that uses a method the site never supported, such as a WebDAV client pointed at a normal website.

If you run the server

  • A client, SDK or proxy sends a method your framework has no route for anywhere and you map that to 501.
  • A request arrives with Transfer-Encoding set to something other than chunked, and the HTTP server library rejects it with 501.
  • An API gateway or managed load balancer that does not support a method, such as TRACE on AWS Application Load Balancers.

How to fix it

If you are visiting the site

  • Use the site in a regular browser, or check that your tool is configured for the right kind of server; nothing on your side will make the server support the method.

If you run the server

  • Check the method in the access log. If it should be supported, add the route; if it should only be refused on some paths, switch those to 405 with an Allow header.
  • For Transfer-Encoding errors, make the client send chunked or a Content-Length; do not relax the server check, because ambiguous framing is how request smuggling works.
  • Document which methods the API supports and answer OPTIONS requests accordingly.

How to send 501

Express (Node.js)
const SUPPORTED = new Set(['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']);

// Before the routes: refuse methods the whole server does not know
app.use((req, res, next) => {
  if (SUPPORTED.has(req.method)) return next();
  res.status(501).json({ error: req.method + ' is not implemented' });
});
Next.js App Router route handler
// app/reports/[id]/route.ts
export async function PATCH() {
  return Response.json(
    { error: 'PATCH is not implemented on this server' },
    { status: 501 }
  );
}
Go net/http
mux.HandleFunc("PATCH /reports/{id}", func(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusNotImplemented) // 501
	w.Write([]byte(`{"error":"PATCH is not implemented on this server"}`))
})
Python FastAPI
from fastapi import FastAPI, HTTPException

app = FastAPI()

@app.patch("/reports/{id}")
def patch_report(id: str):
    raise HTTPException(status_code=501, detail="PATCH is not implemented on this server")

Commonly confused with

501 vs 405
405 means this URL does not allow the method but the server knows it, and it must list the allowed ones in Allow; 501 means the server supports the method nowhere.
501 vs 505
505 rejects the HTTP version in the request line; 501 rejects the method or a feature within a version the server does speak.

Frequently asked questions

What is the difference between 501 and 405?
405 Method Not Allowed is resource-specific: the server knows the method but this URL refuses it, and the response lists the allowed methods in Allow. 501 Not Implemented is server-wide: the method or feature is not supported for any URL.
Can I use 501 for an API endpoint that is not finished yet?
You can, and it is clearer than a 404 because it tells the client the URL is right but the server cannot do it yet. Once the endpoint ships, the 501 goes away; because 501 is heuristically cacheable, send Cache-Control: no-store on the stub.
Is a 501 error temporary?
Not in the usual sense. It reflects missing functionality, so retrying the same request will keep failing until the server is updated or the client uses a different method or encoding.

Last reviewed by Arielton Oberek.