Lychee: error - Server Error in Diagnotics section after migration 4.4.0 to 4.6.0
Hello. I made a manual migration from 4.4.0 to 4.6.0 all seem to working fine except the diagnostics section wich show error - Server Error message and blank page.
logs report that error :
2022-09-09 17:52:39 UTC -- error -- PDO::prepare -- 368 -- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'owner_id' in 'field list'
2022-09-09 17:52:39 UTC -- error -- App\Actions\Diagnostics\Checks\MissingUserCheck::check -- 13 -- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'owner_id' in 'field list'; caused by
2022-09-09 17:52:39 UTC -- error -- Illuminate\Database\Connection::runQueryCallback -- 712 -- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'owner_id' in 'field list' (SQL: select `owner_id` from `albums` group by `owner_id`); caused by
2022-09-09 17:52:39 UTC -- error -- App\Actions\Diagnostics\Checks\MissingUserCheck::check -- 13 -- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'owner_id' in 'field list' (SQL: select `owner_id` from `albums` group by `owner_id`); caused by
Found another issue when uploading pictures
2022-09-09 18:32:35 UTC -- error -- PDOStatement::execute -- 501 -- SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1662748355' for key 'photos_legacy_id_unique'
2022-09-09 18:32:35 UTC -- error -- App\Models\Photo::performInsert -- 106 -- SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1662748355' for key 'photos_legacy_id_unique'; caused by
2022-09-09 18:32:35 UTC -- error -- Illuminate\Database\Connection::runQueryCallback -- 712 -- SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1662748355' for key 'photos_legacy_id_unique' (SQL: insert into `photos` (`legacy_id`, `owner_id`, `album_id`, `title`, `description`, `tags`, `license`, `is_public`, `is_starred`, `iso`, `make`, `model`, `lens`, `aperture`, `shutter`, `focal`, `latitude`, `longitude`, `altitude`, `img_direction`, `location`, `taken_at`, `taken_at_orig_tz`, `type`, `filesize`, `checksum`, `original_checksum`, `live_photo_short_path`, `live_photo_content_id`, `live_photo_checksum`, `updated_at`, `created_at`, `id`) values (1662748355, 0, Pnr3zasQ422JGorllNRj1NPv, 19-IMG_4059, ?, ?, none, 0, 0, 125, Canon, Canon PowerShot G12, ?, f/4.0, 1/160 s, 6 mm, ?, ?, ?, ?, ?, 2016-04-21 10:27:25.000000, UTC, image/jpeg, 0, 5548b3c4029835b873c7efd0920378aa2618741c, 5548b3c4029835b873c7efd0920378aa2618741c, ?, ?, ?, 2022-09-09 18:32:35.926919, 2022-09-09 18:32:35.926919, 5h8lSNYrbDjjh8sFEIb7QtRq)); caused by
2022-09-09 18:32:35 UTC -- error -- App\Models\Photo::performInsert -- 106 -- SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1662748355' for key 'photos_legacy_id_unique' (SQL: insert into `photos` (`legacy_id`, `owner_id`, `album_id`, `title`, `description`, `tags`, `license`, `is_public`, `is_starred`, `iso`, `make`, `model`, `lens`, `aperture`, `shutter`, `focal`, `latitude`, `longitude`, `altitude`, `img_direction`, `location`, `taken_at`, `taken_at_orig_tz`, `type`, `filesize`, `checksum`, `original_checksum`, `live_photo_short_path`, `live_photo_content_id`, `live_photo_checksum`, `updated_at`, `created_at`, `id`) values (1662748355, 0, Pnr3zasQ422JGorllNRj1NPv, 19-IMG_4059, ?, ?, none, 0, 0, 125, Canon, Canon PowerShot G12, ?, f/4.0, 1/160 s, 6 mm, ?, ?, ?, ?, ?, 2016-04-21 10:27:25.000000, UTC, image/jpeg, 0, 5548b3c4029835b873c7efd0920378aa2618741c, 5548b3c4029835b873c7efd0920378aa2618741c, ?, ?, ?, 2022-09-09 18:32:35.926919, 2022-09-09 18:32:35.926919, 5h8lSNYrbDjjh8sFEIb7QtRq)); caused by
2022-09-09 18:32:35 UTC -- error -- App\Exceptions\ModelDBException::create -- 50 -- Updating photo failed; caused by
I use MariaDB 10.3.36, PHP 8.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (10 by maintainers)
I have a fix in place. The problem was not the type of exception, but a change from integer values to string values for error codes. Could anybody, please, please, please tell the Laravel guys that PHP supports type annotation for some years now and that type safety is a good thing. 🤬
I confirm the second issue (with duplicate entries). @nagmat84, it appears that in the
HasRandomIDAndLegacyTimeBasedIDtrait we now fail to catch the exception inperformInsert, possibly because the exception type is nowModelDBExceptionrather thanQueryException? This is easy to reproduce by settingforce_32bit_idsto1and uploading several small photos at once over a fast link.Your first errors from the logs (about
owner_id) indicate that your installation tree is messed up. You mentioned that you upgraded from 4.4.0 to 4.6.0 manually, and I’m guessing you still have some obsolete files from version 4.4.0 left. In particular,Lychee/app/Actions/Diagnostics/Checks/MissingUserCheck.phpshould not exist in version 4.6.0. So you need to clean that up first.Now, regarding the errors about duplicate entry
1662748355. What you are seeing there are duplicate legacy IDs being generated; in principle this could only happen with 32-bit PHP installations and when adding new photos very quickly.force_32bit_idsconfig variable and if it’s set to1, try resetting it to0.In principle, we have code in place that should transparently deal with duplicate entries like that, but that code has recently been refactored and perhaps a bug managed to creep in…