Have to admit I've never used this code, and didn't know what it was about. Quickly read up about it. So ETag is a hash of the resource. You must provide it with requests that modify the resource. If your hash doesn't match the server hash, then 412 Precondition Failed is returned?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412
https://www.rfc-editor.org/rfc/rfc9110#status.412