The place in the code is actually misleading, as it the error is only prepared at that place after all headers have been read. The error will only be reported, however, only later on if the connection is closed while there's still data expected on the connection. That will be the case if a `Content-Length` was specified but less than the given number of bytes was read before the connection was closed, or if `chunked` transfer encoding was used, if the connection was closed before the final empty chunk was sent.
You could set `akka.http.server.log-unencrypted-network-bytes = 1000` to see all data that was sent on the connection which might help with debugging the issue.