immich icon indicating copy to clipboard operation
immich copied to clipboard

Metadata extraction jobs need better error handling

Open bo0tzz opened this issue 1 year ago • 1 comments

Both the image exif and video metadata jobs need better error handling. Currently, both are wrapped in one big try/catch that just gives up on any errors. Meanwhile, any bad data that doesn't cause an immediate exception isn't validated well and causes an error on database insert:

ERROR [MetadataExtractionProcessor] Error extracting EXIF QueryFailedError: invalid input syntax for type timestamp with time zone: "0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN"
QueryFailedError: invalid input syntax for type timestamp with time zone: "0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN"
    at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
(...)

Another problem is that these jobs are responsible for saving the original filename as passed in the asset upload call. If these jobs fail, that filename is lost.

This needs some refactoring so that

  1. Better data validation is performed.
  2. A best-effort attempt is made to still save whatever data can be saved to the database when an error occurs.
  3. All errors are clearly logged with relevant (asset) IDs and, where applicable, actionable error messages.

bo0tzz avatar Apr 10 '23 14:04 bo0tzz

I don't think #2230 addressed 1 nor 2 points.

samip5 avatar Apr 11 '23 14:04 samip5

Should be resolved by #2908.

uhthomas avatar Jul 09 '23 20:07 uhthomas