423

Locked

Overview

423 Locked means the resource being accessed is locked (a WebDAV lock), so the request cannot proceed. WebDAV provides an explicit LOCK mechanism so collaborators do not overwrite each other's edits to the same file.

When one user has locked a file and another tries to write to it (PUT/DELETE/MOVE) without a valid lock token, the server returns 423. It mainly appears in document-collaboration setups (Microsoft Office, Nextcloud, ownCloud).

When it happens

Request / Response example

Request
PUT /docs/report.docx HTTP/1.1
Host: dav.example.com
Content-Type: application/octet-stream

<file body>
Response
HTTP/1.1 423 Locked
Content-Type: application/xml

<?xml version="1.0"?>
<D:error xmlns:D="DAV:"><D:lock-token-submitted/></D:error>

In code

app.put('/docs/:name', (req, res) => {
  const lock = locks.get(req.params.name);
  if (lock && lock.token !== req.headers['if']) {
    return res.status(423).type('xml')
      .send('<D:error xmlns:D="DAV:"><D:lock-token-submitted/></D:error>');
  }
  // write the file...
});
# Supply the lock token in the If header to edit a locked WebDAV resource
curl -X PUT https://dav.example.com/docs/report.docx \
  -H 'If: (<urn:uuid:lock-token-here>)' \
  --data-binary @report.docx

Common causes

How to fix

Notes

Related status codes

Related headers

Lock-TokenIf

Specification