Bug 40708 - Increase accuracy and accessibility of checkin errors
Summary: Increase accuracy and accessibility of checkin errors
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-26 18:03 UTC by Andrew Fuerste-Henry
Modified: 2025-10-16 09:06 UTC (History)
6 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.04
Circulation function:


Attachments
Bug 40708: Return the specific error to the checkin page (5.11 KB, patch)
2025-08-29 12:09 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40708: Return the specific error to the checkin page (5.13 KB, patch)
2025-08-29 12:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40708: Return the specific error to the checkin page (5.18 KB, patch)
2025-08-29 13:50 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 40708: Return the specific error to the checkin page (5.12 KB, patch)
2025-08-29 17:05 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40708: Return the specific error to the checkin page (5.17 KB, patch)
2025-08-29 17:13 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 40708: Return the specific error to the checkin page (5.25 KB, patch)
2025-09-16 10:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40708: Fix link to the about page (1.59 KB, patch)
2025-09-16 10:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40708: Fix Circulation/Returns.t (1.45 KB, patch)
2025-09-16 10:02 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2025-08-26 18:03:31 UTC
When a checkin in Koha returns "data_corrupted," the checkin fails and koha displays the message "The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the about page and correct all errors shown on the "System information.""

This message should be more specific and accurate, as there are a wide variety of potential causes and not all of them are reported in any way in the About page.
Comment 1 Nick Clemens (kidclamp) 2025-08-29 12:09:16 UTC
Created attachment 185911 [details] [review]
Bug 40708: Return the specific error to the checkin page

When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues.
We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples

This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user.

To test:
1 - Issue an item to a patron, note the itemnumber
2 - On the command line, lock the row:
    sudo koha-mysql kohadev
    START TRANSACTION;
    SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE;
    leave mysql open at this point
3 - On the interface, check in the item, wait a bit
4 - After a bit you get the error to check the config page, but nothing is there
5 - close mysql, apply patch, restart all
6 - Repeat 2
7 - Check in the item, wait a bit
8 - Note you now get the error from the DB:
    Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
9 - Sign off!
Comment 2 Nick Clemens (kidclamp) 2025-08-29 12:47:29 UTC
Created attachment 185912 [details] [review]
Bug 40708: Return the specific error to the checkin page

When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues.
We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples

This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user.

To test:
1 - Issue an item to a patron, note the itemnumber
2 - On the command line, lock the row:
    sudo koha-mysql kohadev
    START TRANSACTION;
    SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE;
    leave mysql open at this point
3 - On the interface, check in the item, wait a bit
4 - After a bit you get the error to check the config page, but nothing is there
5 - close mysql, apply patch, restart all
6 - Repeat 2
7 - Check in the item, wait a bit
8 - Note you now get the error from the DB:
    Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
9 - Sign off!
Comment 3 Brendan Lawlor 2025-08-29 13:50:48 UTC
Created attachment 185929 [details] [review]
Bug 40708: Return the specific error to the checkin page

When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues.
We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples

This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user.

To test:
1 - Issue an item to a patron, note the itemnumber
2 - On the command line, lock the row:
    sudo koha-mysql kohadev
    START TRANSACTION;
    SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE;
    leave mysql open at this point
3 - On the interface, check in the item, wait a bit
4 - After a bit you get the error to check the config page, but nothing is there
5 - close mysql, apply patch, restart all
6 - Repeat 2
7 - Check in the item, wait a bit
8 - Note you now get the error from the DB:
    Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
9 - Sign off!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 4 Brendan Lawlor 2025-08-29 13:57:20 UTC
This issue has recently been affecting us. Thanks for the quick patch!


Just a note on step 8, both of the error messages were displayed in this order:

Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )

The item has not been checked in due to an issue in your system. Note the error below. An administrator may find further details by looking at the about page and correcting errors shown on the "System information" tab, or note the error below.

I'm signing off to move this along but the error should be displayed below the message as it says 'note the error below'.
Comment 5 Andrew Fuerste-Henry 2025-08-29 14:09:28 UTC
(In reply to Brendan Lawlor from comment #4)
> This issue has recently been affecting us. Thanks for the quick patch!
> 
> 
> Just a note on step 8, both of the error messages were displayed in this
> order:
> 
> Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception:
> DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting
> transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
> 
> The item has not been checked in due to an issue in your system. Note the
> error below. An administrator may find further details by looking at the
> about page and correcting errors shown on the "System information" tab, or
> note the error below.
> 
> I'm signing off to move this along but the error should be displayed below
> the message as it says 'note the error below'.

I got the error message above the explanatory text once in my testing and then could not replicate it consistently.

We should end that message at "shown on the 'System information' tab." In fiddling with the wording we ended up repeating ourselves.
Comment 6 Nick Clemens (kidclamp) 2025-08-29 17:05:33 UTC
Created attachment 185943 [details] [review]
Bug 40708: Return the specific error to the checkin page

When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues.
We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples

This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user.

To test:
1 - Issue an item to a patron, note the itemnumber
2 - On the command line, lock the row:
    sudo koha-mysql kohadev
    START TRANSACTION;
    SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE;
    leave mysql open at this point
3 - On the interface, check in the item, wait a bit
4 - After a bit you get the error to check the config page, but nothing is there
5 - close mysql, apply patch, restart all
6 - Repeat 2
7 - Check in the item, wait a bit
8 - Note you now get the error from the DB:
    Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
9 - Sign off!
Comment 7 Brendan Lawlor 2025-08-29 17:13:40 UTC
Created attachment 185945 [details] [review]
Bug 40708: Return the specific error to the checkin page

When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues.
We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples

This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user.

To test:
1 - Issue an item to a patron, note the itemnumber
2 - On the command line, lock the row:
    sudo koha-mysql kohadev
    START TRANSACTION;
    SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE;
    leave mysql open at this point
3 - On the interface, check in the item, wait a bit
4 - After a bit you get the error to check the config page, but nothing is there
5 - close mysql, apply patch, restart all
6 - Repeat 2
7 - Check in the item, wait a bit
8 - Note you now get the error from the DB:
    Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
9 - Sign off!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 8 Brendan Lawlor 2025-08-29 17:14:39 UTC
I tested with the same item I used previously and now the message and the error display in the correct order.

Nice!
Comment 9 Jonathan Druart 2025-09-16 10:02:15 UTC
Created attachment 186468 [details] [review]
Bug 40708: Return the specific error to the checkin page

When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues.
We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples

This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user.

To test:
1 - Issue an item to a patron, note the itemnumber
2 - On the command line, lock the row:
    sudo koha-mysql kohadev
    START TRANSACTION;
    SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE;
    leave mysql open at this point
3 - On the interface, check in the item, wait a bit
4 - After a bit you get the error to check the config page, but nothing is there
5 - close mysql, apply patch, restart all
6 - Repeat 2
7 - Check in the item, wait a bit
8 - Note you now get the error from the DB:
    Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
9 - Sign off!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2025-09-16 10:02:17 UTC
Created attachment 186469 [details] [review]
Bug 40708: Fix link to the about page

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2025-09-16 10:02:19 UTC
Created attachment 186470 [details] [review]
Bug 40708: Fix Circulation/Returns.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Jonathan Druart 2025-09-16 11:03:05 UTC
Notes:
Getting a 500 when checking in from the checkout page
Exception 'Koha::Exceptions::Checkout::FailedRenewal' thrown 'Update of issue# 3 failed with error: Lock wait timeout exceeded; try restarting transaction'


From returns.pl:
"""
BC_1: E Street shuffle :

The item has not been checked in due to an issue in your system. Note the error below. An administrator may find further details by looking at the about page and correcting errors shown on the "System information" tab, or note the error below.

Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 )
"""
Comment 13 Lucas Gass (lukeg) 2025-09-19 14:45:15 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 14 Paul Derscheid 2025-09-25 16:30:54 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 15 Fridolin Somers 2025-10-16 09:06:48 UTC
I prefer not backport to 24.11.x for UI stability