immich-go icon indicating copy to clipboard operation
immich-go copied to clipboard

from-immich Image datetime - Internal Server Error 500

Open ic-08 opened this issue 11 months ago • 13 comments

I am getting Internal Server Errors on files that have something to do with time (although I'm not entirely sure)

This is the callback from the immich server :

immich_server            | [Nest] 17  - 04/15/2025, 10:04:52 AM   ERROR [Api:ErrorInterceptor~6kmvrf7q] Unknown error: 
PostgresError: date/time field value out of range: "0000-12-31T19:00:00-05:00"
immich_server            | PostgresError: date/time field value out of range: "0000-12-31T19:00:00-05:00"
immich_server            |     at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:788:26)
immich_server            |     at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:474:6)
immich_server            |     at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
immich_server            |     at Socket.emit (node:events:518:28)
immich_server            |     at addChunk (node:internal/streams/readable:561:12)
immich_server            |     at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
immich_server            |     at Readable.push (node:internal/streams/readable:392:5)
immich_server            |     at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
immich_server            |     at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
immich_server            | Query failed : {
immich_server            |   durationMs: 0.9221109971404076,
immich_server            |   error: PostgresError: date/time field value out of range: "0000-12-31T19:00:00-05:00"
immich_server            |       at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:788:26)
immich_server            |       at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:474:6)
immich_server            |       at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
immich_server            |       at Socket.emit (node:events:518:28)
immich_server            |       at addChunk (node:internal/streams/readable:561:12)
immich_server            |       at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
immich_server            |       at Readable.push (node:internal/streams/readable:392:5)
immich_server            |       at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
immich_server            |       at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
immich_server            |     severity_local: 'ERROR',
immich_server            |     severity: 'ERROR',
immich_server            |     code: '22008',
immich_server            |     where: "unnamed portal parameter $2 = '...'",
immich_server            |     file: 'datetime.c',
immich_server            |     line: '3773',
immich_server            |     routine: 'DateTimeParseError'
immich_server            |   },
immich_server            |   sql: 'insert into "exif" ("assetId", "dateTimeOriginal") values ($1::uuid, $2) on conflict ("assetId") do update set "dateTimeOriginal" = "excluded"."dateTimeOriginal"',
immich_server            |   params: [
immich_server            |     'eab9ebee-4fbf-4f5f-ae64-0d1c55ea3f4b',
immich_server            |     '0000-12-31T19:00:00-05:00'
immich_server            |   ]
immich_server            | }

And the following comes from the immich-go log file:

-- response body start --
{"id":"ff07f85a-b875-4458-af3a-bce0522c9ba7","status":"created"}
-- response body end --

2025-04-14T23:26:57-04:00 QUERY 87 updateAsset PUT http://192.168.2.89:2283/api/assets/ff07f85a-b875-4458-af3a-bce0522c9ba7
   Content-Type [application/json]
   X-Api-Key redacted
-- body start --
{"dateTimeOriginal":"0000-12-31T19:00:00-05:00"}
-- body end --

2025-04-14T23:26:57-04:00 RESPONSE 87 updateAsset PUT http://192.168.2.89:2283/api/assets/ff07f85a-b875-4458-af3a-bce0522c9ba7
  Status: 500 Internal Server Error
-- response body --
-- response body end --

It shows that the dateTimeOriginal is 0000-12-31 so I am assuming the date is incorrect. In a library of 24 thousand photos, a total of ~2400 had this similar issue. I'm not entirely sure if I'm doing anything wrong on my part or if this is an existing bug. All the photos show up fine in the app (it shows 24 thousand when highlighted) so I'd assume there is some date associated with these ~2.4 thousand photos.

The command I run is :

immich-go upload from-immich --server=http://192.168.2.89:2283 --api-key="" --from-server=http://192.168.2.10:2283 --from-api-key="" --client-timeout=20m0s

ic-08 avatar Apr 15 '25 14:04 ic-08

EDIT : The pasted content from the terminal is not referencing the same file. However, all of the files have similar errors like this.

ic-08 avatar Apr 15 '25 15:04 ic-08

Could you provide one of concerned files?

simulot avatar Apr 16 '25 09:04 simulot

Could you provide one of concerned files?

Could you provide me your email? The trace log contains a LOT of files and their geolocation respectively. I would rather send it privately.

ic-08 avatar Apr 16 '25 14:04 ic-08

You can DM files to my discord @simulot

simulot avatar Apr 16 '25 15:04 simulot

Any update here. I am having a same issue. The dates are there in the source db unless I am looking at the wrong table in the source pg db.

thadthig avatar May 06 '25 15:05 thadthig

@thadthig, I ran the command again with --on-server-errors continue as an option and it ran fine even while still getting errors (albeit at a much lower frequency). I believe most of the photos did actually end up transferring over but the core issue hasn't been solved. @simulot wasn't able to reproduce the conditions either.

IN FACT :

2025-04-14T23:26:57-04:00 RESPONSE 87 updateAsset PUT http://192.168.2.89:2283/api/assets/ff07f85a-b875-4458-af3a-bce0522c9ba7
Status: 500 Internal Server Error
-- response body --
-- response body end --

This section in the log file specifies the file http://192.168.2.89:2283/api/assets/ff07f85a-b875-4458-af3a-bce0522c9ba7 which does exist

The link gives the file information :

...
  "deviceId": "pc",
  "libraryId": null,
  "type": "IMAGE",
  "originalPath": "upload/library/admin/2025/Apr/IMG_0376.heic",
  "originalFileName": "IMG_0376.HEIC",
  "originalMimeType": "image/heic",
  "thumbhash": "XwgKBACY92d3q2FWaJWIf4MOdA==",
  "fileCreatedAt": "2025-04-03T17:35:28.150Z",
  "fileModifiedAt": "2025-04-15T03:26:57.000Z",
  "localDateTime": "2025-04-03T13:35:28.150Z",
  "updatedAt": "2025-04-18T23:08:32.979Z",
  "isFavorite": false,
  "isArchived": false,
  "isTrashed": false,
  "duration": "0:00:00.00000",
  "exifInfo": {
    "make": "Apple",
...

The file does exist on the new server, date is correct, and isn't {"dateTimeOriginal":"0000-12-31T19:00:00-05:00"} as specified in the log file.

ic-08 avatar May 06 '25 22:05 ic-08

Are you using the latest version of immich and immich-go?

You can pause all I'm immich's job. This is known to interfere with upload

simulot avatar May 07 '25 06:05 simulot

Are you using the latest version of immich and immich-go?

You can pause all I'm immich's job. This is known to interfere with upload

Yes, I am using the latest.

thadthig avatar May 07 '25 14:05 thadthig

@ic-08 --on-server-errors continue got me through. 47K uploads had 2K errors. Thanks.

thadthig avatar May 07 '25 14:05 thadthig

Errors are likely due to Immich's background jobs.

simulot avatar May 07 '25 14:05 simulot

@simulot I'm running into a similar issue and decided to run the command allowing all the errors,.

every single image had the error, and only a few of my images have the correct date. I double checked none of the backgrounds job's were running.

immich server log

[Nest] 17  - 06/04/2025, 9:36:50 PM   ERROR [Api:ErrorInterceptor~srkl4laj] Unknown error: PostgresError: date/time field value out of range: "0000-12-31T19:03:58-04:56"

PostgresError: date/time field value out of range: "0000-12-31T19:03:58-04:56"

    at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)

    at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)

    at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)

    at Socket.emit (node:events:518:28)

    at addChunk (node:internal/streams/readable:561:12)

    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)

    at Readable.push (node:internal/streams/readable:392:5)

    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)

both immich server's are running v1.134.0 and immich-go is version v0.26.3

PataconVP avatar Jun 05 '25 02:06 PataconVP

Could you try again with --log-level=TRUE and --api-trace. Then share the log files. I would like to se what immich-go is actually sending to Immich.

simulot avatar Jun 07 '25 10:06 simulot

Similar error and then thses images end up taking today's date and time. I am running the following from another Immich server which I am trying to migrate.

immich-go upload from-immich --on-server-errors=continue --from-server=http://SOURCE:2283 --from-api-key=SOURCE_KEY --server=http://DESTINATION:2283 --api-key=DESTINATION_KEY

Immich: v1.138.1 Immich-Go: 0.27.0

Query failed : {

  durationMs: 1.586081000044942,

  error: PostgresError: date/time field value out of range: "0000-12-31T19:03:58-04:56"

      at ErrorResponse (/usr/src/app/server/node_modules/postgres/cjs/src/connection.js:794:26)

      at handle (/usr/src/app/server/node_modules/postgres/cjs/src/connection.js:480:6)

      at Socket.data (/usr/src/app/server/node_modules/postgres/cjs/src/connection.js:315:9)

      at Socket.emit (node:events:518:28)

      at addChunk (node:internal/streams/readable:561:12)

      at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)

      at Readable.push (node:internal/streams/readable:392:5)

      at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

      at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {

    severity_local: 'ERROR',

    severity: 'ERROR',

    code: '22008',

    where: "unnamed portal parameter $2 = '...'",

    file: 'datetime.c',

    line: '3773',

    routine: 'DateTimeParseError'

  },

  sql: 'insert into "asset_exif" ("assetId", "dateTimeOriginal", "latitude", "longitude") values ($1::uuid, $2, $3, $4) on conflict ("assetId") do update set "dateTimeOriginal" = "excluded"."dateTimeOriginal", "latitude" = "excluded"."latitude", "longitude" = "excluded"."longitude"',

  params: [

    '8835fd18-e755-449a-add2-af6cfb99d30d',

    '0000-12-31T19:03:58-04:56',

    34.1499583333333,

    -83.8189166666667

  ]

}

[Nest] 17  - 08/20/2025, 7:43:58 PM   ERROR [Api:ErrorInterceptor~en0lie27] Unknown error: PostgresError: date/time field value out of range: "0000-12-31T19:03:58-04:56"

PostgresError: date/time field value out of range: "0000-12-31T19:03:58-04:56"

    at ErrorResponse (/usr/src/app/server/node_modules/postgres/cjs/src/connection.js:794:26)

    at handle (/usr/src/app/server/node_modules/postgres/cjs/src/connection.js:480:6)

    at Socket.data (/usr/src/app/server/node_modules/postgres/cjs/src/connection.js:315:9)

    at Socket.emit (node:events:518:28)

    at addChunk (node:internal/streams/readable:561:12)

    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)

    at Readable.push (node:internal/streams/readable:392:5)

    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)

dhruvb14 avatar Aug 20 '25 19:08 dhruvb14