424 Failed Dependency
HTTP response status code 424 Failed Dependency is a client error that is returned by the server as part of a 207 Multi-Status response and is used to indicate that the requested operation can not be performed because it depends on another action that had failed.
Usage
The 424 Failed Dependency error message is part of WebDAV, used as a file system over HTTP. When this error message is received, it will not appear outside of the message body as part of a 207 Multi-Status response. This is indeed an example of where the successful response actually contains an indication of failure.
The client is responsible for parsing the multi-status response and upon discovering the 424 Failed Dependency error(s), determining the issue and resolving it accordingly.
This status might be encountered during a PROPPATCH
action, where several properties are being modified at one time in a single HTTP request. Generally, an HTTP request either succeeds or fails and if one of the properties fails to set, then the entire request fails. However, in a situation like this, the properties that will have been successfully set but for the problem with another one, the 424 Failed Dependency status is used.
Note
Search engines like Google will not index a URL with 424 Failed Dependency response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.
Example
In the example, the client submits a request to update seat numbers and the name for a conference registration record. After somebody is registered initially, seats can be added, removed, or changed. However, no modifications to the name are allowed. Because the name change is denied with 403 Prohibited, the entire request is denied, meaning that updates to seating arrangements are not completed.
Request
PROPPATCH /update.html HTTP/1.1
Host: www.example.re
Content-Type: applications/xml; charset=”utf-8”
Content-Length: 305
<?xml version="1.0" encoding="utf-8" ?>
<d:propertyupdate xmlns:D="DAV:"
<d:set>
<d:prop>
<d:seats>
<z:seatnumber>100</z:seatnumber>
<z:seatnumber>101</Z:seatnumber>
</z:seats>
</d:prop>
<d:prop>
<d:name>Smith</d:name>
</d:prop>
</d:set>
</d:propertyupdate>
Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"
Content-Length: 528
<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:d="DAV:">
<d:response>
<d:href>http://www.example.re/registrants/update.html</d:href>
<d:propstat>
<d:prop><Z:seats/></d:prop>
<d:status>HTTP/1.1 424 Dependency Failed</d:status>
</d:propstat>
<d:propstat>
<d:prop><z:name/></d:prop>
<d:status>HTTP/1.1 403 Forbidden</d:status>
</d:propstat>
<d:responsedescription>The name of the registrant cannot be changed.
</d:response>
</d:multistatus>
Code references
.NET
HttpStatusCode.FailedDependency
Rust
http::StatusCode::FAILED_DEPENDENCY
Rails
:failed_dependency
Go
http.StatusFailedDependency
Symfony
Response::HTTP_FAILED_DEPENDENCY
Python3.5+
http.HTTPStatus.FAILED_DEPENDENCY
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_FAILED_DEPENDENCY
Angular
@angular/common/http/HttpStatusCode.FailedDependency
Takeaway
The 424 Failed Dependency status code is a client error that is generated as part of a multi-status response and indicates that an action can not be completed because another action has failed.