I
Immich2y ago
TumTum

Corrupt files when downloading photos from External Library

When I download an asset from an external library, the resulting file is corrupt. The downloaded file size is identical to the original, but it is missing metadata and won't display in any photo viewers. Assets in the default library (uploaded with the Immich app natively) do not have this issue. I'm on the latest server version and app version. My docker-compose is pretty standard but I can share it if needed. Relevant log snippets generated when I tried to download an asset: immich_proxy log 2023/10/17 22:40:52 [warn] 47#47: *3112 upstream sent more data than specified in "Content-Length" header while reading upstream, client: 10.0.3.109, server: , request: "POST /api/asset/download/8aea94d6-3f76-4bfa-87f2-b971ee34e1a9 HTTP/1.1", upstream: "http://172.30.0.7:3001/asset/download/8aea94d6-3f76-4bfa-87f2-b971ee34e1a9", host: "my-docker-host.com:2283", referrer: "http://my-docker-host.com:2283/photos" immich_server log [Nest] 7 - 10/17/2023, 10:40:52 PM ERROR [ExpressAdapter] Premature close Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close at new NodeError (node:internal/errors:406:5) at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30) at ServerResponse.emit (node:events:526:35) at emitCloseNT (node:_http_server:1023:10) at Socket.onServerResponseClose (node:_http_server:278:5) at Socket.emit (node:events:526:35) at TCP.<anonymous> (node:net:337:12)
11 Replies
Immich
Immich2y ago
[PR] Dev/modify map plugin (#47)
shenlong-tanwen
Is the asset offline and downloading from web works for the same asset?
TumTum
TumTumOP2y ago
The assets are online, and they display properly in Immich. Right Click > Save As works fine, but that obviously doesn't download the original file (and isn't an option in the mobile app). The Download function results in a corrupt file on both the web and mobile app.
miknzau
miknzau2y ago
I am seeing this error too, but for me I see it when a mobile device is uploading files from the "backup tool"
2023-10-25 12:54:53 immich_server | [Nest] 7 - 10/25/2023, 5:54:53 AM ERROR [ExpressAdapter] Premature close
2023-10-25 12:54:53 immich_server | Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
2023-10-25 12:54:53 immich_server | at new NodeError (node:internal/errors:406:5)
2023-10-25 12:54:53 immich_server | at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
2023-10-25 12:54:53 immich_server | at ServerResponse.emit (node:events:526:35)
2023-10-25 12:54:53 immich_server | at emitCloseNT (node:_http_server:1023:10)
2023-10-25 12:54:53 immich_server | at Socket.onServerResponseClose (node:_http_server:278:5)
2023-10-25 12:54:53 immich_server | at Socket.emit (node:events:526:35)
2023-10-25 12:54:53 immich_server | at TCP.<anonymous> (node:net:337:12)
2023-10-25 12:54:53 immich_server | [Nest] 7 - 10/25/2023, 5:54:53 AM ERROR [ExpressAdapter] Premature close
2023-10-25 12:54:53 immich_server | Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
2023-10-25 12:54:53 immich_server | at new NodeError (node:internal/errors:406:5)
2023-10-25 12:54:53 immich_server | at ServerResponse.onclose (node:internal/streams/end-of-stream:159:30)
2023-10-25 12:54:53 immich_server | at ServerResponse.emit (node:events:526:35)
2023-10-25 12:54:53 immich_server | at emitCloseNT (node:_http_server:1023:10)
2023-10-25 12:54:53 immich_server | at Socket.onServerResponseClose (node:_http_server:278:5)
2023-10-25 12:54:53 immich_server | at Socket.emit (node:events:526:35)
2023-10-25 12:54:53 immich_server | at TCP.<anonymous> (node:net:337:12)
jrasm91
jrasm912y ago
Can this be reproduced by accessing immich via local IP?
miknzau
miknzau2y ago
I am accessing via 192.168.1.*** is that what you mean?
jrasm91
jrasm912y ago
Yeah
jrasm91
jrasm912y ago
Looks like it might be related to this. https://stackoverflow.com/a/46694782
Stack Overflow
Express and nginx net::ERR_CONTENT_LENGTH_MISMATCH
I'm developing an Express-driven site, that is going through an nginx proxy. Sometimes when loading a page in the browser, I get this: GET http://myapp.local/css/bootstrap.css net::
jrasm91
jrasm912y ago
Does this happen for all files by the way?
miknzau
miknzau2y ago
I can't really tell. I see it a lot. But yet my setup seems to be working now with new files appearing in the UI after upload. But here is a screenshot of my immich_server log. edit Actually I think, no it is not happening with all files.
No description
jrasm91
jrasm912y ago
premature close is an unrelated error. I think this ticket is specifically about downloading files. The premature close is from hovering over files that kick off a preview of a video.

Did you find this page helpful?