HTTP 423 Locked: what it means and how to fix it
Meaning
HTTP 423 Locked means a WebDAV resource is protected by a write lock. Find the lock token or wait for expiry before retrying the write.
A 423 tells you to stop writing and find out who holds the lock. The code comes from WebDAV, not from core HTTP. RFC 4918 section 11.3 defines it with the reason phrase Locked: “the source or destination resource of a method is locked.” The IANA status code registry lists it against RFC 4918. RFC 9110 does not define it.
A write lock blocks the methods that change a resource: PUT, DELETE, MOVE, PROPPATCH and a second LOCK. It does not block reading. In the tests below, a GET on the locked file still returned 200 OK. A 423 on a plain GET means the server is using the code for something of its own.
Reproduce it with curl
This server keeps one write lock per path and refuses a PUT that does not carry the token. It is Python 3.15.0 with nothing outside the standard library.
# locked423.py - Python 3.15.0. One file, one write lock, nothing else.
import uuid
from http.server import BaseHTTPRequestHandler, HTTPServer
LOCKS = {} # path -> lock token
class H(BaseHTTPRequestHandler):
def do_LOCK(self):
if self.path in LOCKS:
return self.reply(423)
LOCKS[self.path] = f"opaquelocktoken:{uuid.uuid4()}"
self.reply(200, {"Lock-Token": f"<{LOCKS[self.path]}>"})
def do_PUT(self):
token = LOCKS.get(self.path)
if token and token not in self.headers.get("If", ""):
body = (b'<?xml version="1.0" encoding="utf-8"?>\n<D:error xmlns:D="DAV:">'
b'<D:lock-token-submitted><D:href>' + self.path.encode() +
b'</D:href></D:lock-token-submitted></D:error>\n')
return self.reply(423, {"Content-Type": "application/xml"}, body)
self.reply(204)
def reply(self, code, headers={}, body=b""):
self.send_response(code)
for k, v in headers.items():
self.send_header(k, v)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
HTTPServer(("127.0.0.1", 8423), H).serve_forever()
Take the lock, then try to overwrite the file without it. curl 8.7.1 on macOS:
$ curl -si -X LOCK http://127.0.0.1:8423/report.txt
HTTP/1.0 200 OK
Server: BaseHTTP Python/3.15.0
Date: Wed, 21 Oct 2026 20:00:04 GMT
Lock-Token: <opaquelocktoken:f4c856aa-5fcc-46f2-a0ab-e17f2379b3bd>
Content-Length: 0
$ curl -si -T new.txt http://127.0.0.1:8423/report.txt
HTTP/1.0 423 Locked
Server: BaseHTTP Python/3.15.0
Date: Wed, 21 Oct 2026 20:00:04 GMT
Content-Type: application/xml
Content-Length: 151
<?xml version="1.0" encoding="utf-8"?>
<D:error xmlns:D="DAV:"><D:lock-token-submitted><D:href>/report.txt</D:href></D:lock-token-submitted></D:error>
Hand the token back in an If header and the same write goes through:
$ curl -si -T new.txt -H 'If: (<opaquelocktoken:f4c856aa-5fcc-46f2-a0ab-e17f2379b3bd>)' http://127.0.0.1:8423/report.txt
HTTP/1.0 204 No Content
Server: BaseHTTP Python/3.15.0
Date: Wed, 21 Oct 2026 20:08:47 GMT
Content-Length: 0
The XML body is the precondition code the RFC asks for. Real servers do not always send it. Apache 2.4.67 with mod_dav, run through the same sequence, answered HTTP/1.1 423 Locked with a text/html page reading “The requested resource is currently locked” and no lock-token element. A DELETE on the locked file also got 423 there. An UNLOCK carrying the token in Lock-Token returned 204 No Content and released it.
What to do when a proxy or scraper gets 423
Look at the origin, not the proxy. A forward proxy has no reason to invent a lock. The failing PUT, sent through Squid 6.13 with -x, came back as the same 423 Locked with the same XML body. Squid only added Cache-Status, Connection and Via: 1.1 lab-proxy (squid/6.13). Changing the exit address does nothing either, because a lock belongs to the resource. The rotating versus sticky choice that matters for blocks is irrelevant here.
Outside WebDAV, APIs reuse 423 for their own lock states, and the body is the only thing that tells you which one. Shopline documents it for a store that is locked, naming exceeded API request limits and account compromise or fraud risk. Help Scout uses it when a resource cannot be modified because limits were reached. Cronofy returns it when it holds no valid credentials for the user’s calendar provider. None of those clear on a retry from a new IP. Stop the job, read the message and follow the vendor’s instructions. If the wording points at request volume, slow down as you would for a 429.
Locks also expire. RFC 4918 section 6.6 lets the client suggest a lifetime and leaves the final value to the server; Apache granted the Second-600 the test asked for. A crashed job that never sent UNLOCK keeps everyone else out until that timer runs down, unless it saved the token somewhere the next run can read.
Causes and fixes
| Cause | How it shows | Fix |
|---|---|---|
| Another client holds a write lock | PUT, DELETE or MOVE get 423; GET still 200 | Wait for UNLOCK or the timeout, then retry once |
| Your own earlier run took the lock and lost the token | The lock owner in the LOCK or PROPFIND response is your job | Persist tokens; send UNLOCK with the stored one; otherwise wait out the timeout |
| Token sent in the wrong header | 423 even though you hold the lock | Writes take If: (<token>); only UNLOCK takes Lock-Token |
| Depth-infinity lock on the parent collection | The 423 body names the parent’s href | Submit the parent’s token |
| API uses 423 for an account or store lock | 423 on a non-WebDAV endpoint, message about limits or the account | Read the vendor’s error docs, contact support, lower the request rate |
| Switching proxy or exit IP | Same 423 from the next address | Nothing to change at the proxy layer |
For the client side of sending these requests through a proxy, see how to use a proxy with curl and proxies in Python.