Bug 32641 - Patron search is not working by firstname or surname after upgradation from 22.05 to 22.11 (due to 500 internal server error)
Summary: Patron search is not working by firstname or surname after upgradation from 2...
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-16 15:34 UTC by Ranjan
Modified: 2024-08-12 13:30 UTC (History)
7 users (show)

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


Attachments
Patron search error by firstname or surname (138.57 KB, image/jpeg)
2023-01-16 15:34 UTC, Ranjan
Details
Error message - returns after searching by Patron Firstname (KOHA 22.11.01) (223.64 KB, image/png)
2023-01-17 05:09 UTC, Ranjan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ranjan 2023-01-16 15:34:41 UTC
Created attachment 145332 [details]
Patron search error by firstname or surname

Not getting any search results using Firstname or surname in Koha 22.11.01. System  returning 500: Internal server error - Month out of range..
Comment 1 Ranjan 2023-01-17 05:09:50 UTC
Created attachment 145348 [details]
Error message - returns after searching by Patron Firstname (KOHA 22.11.01)
Comment 2 David Cook 2023-01-17 05:45:29 UTC
Sounds like bad data.

Unfortunately, that makes this sound more like a support problem than a specific bug per se, although clearly the system should be handling the bad data more gracefully.
Comment 3 David Cook 2023-01-17 05:48:19 UTC
You may want to try the mailing lists, IRC, or contacting a support company: https://koha-community.org/support/
Comment 4 Ranjan 2023-01-17 06:31:13 UTC
How to get the solution of this critical problem.
Comment 5 David Cook 2023-01-17 22:47:38 UTC
(In reply to David Cook from comment #3)
> You may want to try the mailing lists, IRC, or contacting a support company:
> https://koha-community.org/support/

(In reply to Ranjan from comment #4)
> How to get the solution of this critical problem.

Consider one of the options I provided in my earlier comment.

--

I'm not able to reproduce the problem. That error suggests that your Koha API is sending bad data to the Koha UI, but the Koha database should prevent that bad date data from being possible.

If we're going to determine whether or not there is a bug here, we're going to need more information. 

Is this a new installation of Koha, or did you upgrade from an older version?
Comment 6 David Cook 2023-01-18 01:19:27 UTC
You know what... the date stuff is a red herring. The real issue will be the 500 Internal Server Error.

Ranjan, what do you see in the logs for your Koha? There should be some details in the logs files in your /var/log/koha/<instance>/* files.
Comment 7 Ranjan 2023-01-18 01:55:10 UTC
Upgraded from 22.05 to 22.11
Comment 8 quickfire28 2023-04-27 01:58:06 UTC
i have the same error after upgrading koha to latest version.

intranet-error.log

[Thu Apr 27 09:30:07.295368 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.308694 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.322324 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.331470 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.343247 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.354523 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.395259 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.416168 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.424388 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.433685 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.459579 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.467768 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.478201 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.514425 2023] [cgi:error] [pid 8558] [client 172.16.35.152:56691] AH01215: [2023-04-27 09:30:07.51414] [8559] [warn] OpenAPI >>> GET api/v1/patrons [{"message":"Month out of range.","path":"\\/body\\/0\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/1\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/12\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/13\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/14\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/17\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/18\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/19\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/2\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/3\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/4\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/6\\/date_renewed"}]: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.950348 2023] [cgi:error] [pid 8560] [client 172.16.35.152:56711] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.965755 2023] [cgi:error] [pid 8560] [client 172.16.35.152:56711] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.975457 2023] [cgi:error] [pid 8560] [client 172.16.35.152:56711] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:07.983972 2023] [cgi:error] [pid 8560] [client 172.16.35.152:56711] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:08.008304 2023] [cgi:error] [pid 8560] [client 172.16.35.152:56711] AH01215: [2023-04-27 09:30:08.00812] [8561] [warn] OpenAPI >>> GET api/v1/patrons [{"message":"Month out of range.","path":"\\/body\\/0\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/2\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/3\\/date_renewed"}]: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=E
[Thu Apr 27 09:30:58.802709 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
[Thu Apr 27 09:30:58.838325 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
[Thu Apr 27 09:30:58.874883 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
[Thu Apr 27 09:30:58.982971 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
[Thu Apr 27 09:30:59.076490 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
[Thu Apr 27 09:30:59.095116 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: Odd number of elements in anonymous hash at /usr/share/koha/lib/Koha/Object.pm line 430.: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
[Thu Apr 27 09:30:59.162564 2023] [cgi:error] [pid 8621] [client 172.16.35.152:56745] AH01215: [2023-04-27 09:30:59.16167] [8622] [warn] OpenAPI >>> GET api/v1/patrons [{"message":"Month out of range.","path":"\\/body\\/10\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/11\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/12\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/15\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/17\\/date_renewed"},{"message":"Month out of range.","path":"\\/body\\/18\\/date_renewed"}]: /usr/share/koha/api/v1/app.pl, referer: http://172.16.35.114:15000/cgi-bin/koha/members/members-home.pl?firstletter=M
Comment 9 David Cook 2023-04-27 02:01:35 UTC
I had the same thing happen recently and it was bad data.

You probably have '0000-00-00' in some of your date_renewed columns in the borrowers database table. Change those to NULL and you should be fine.
Comment 10 quickfire28 2023-04-27 03:07:40 UTC
(In reply to David Cook from comment #9)
> I had the same thing happen recently and it was bad data.
> 
> You probably have '0000-00-00' in some of your date_renewed columns in the
> borrowers database table. Change those to NULL and you should be fine.

We already check it and there is no 0000-00-00 and already set to null
Comment 11 quickfire28 2023-04-27 03:15:38 UTC
(In reply to quickfire28 from comment #10)
> (In reply to David Cook from comment #9)
> > I had the same thing happen recently and it was bad data.
> > 
> > You probably have '0000-00-00' in some of your date_renewed columns in the
> > borrowers database table. Change those to NULL and you should be fine.
> 
> We already check it and there is no 0000-00-00 and already set to null

there are some with date in it (like this 2019-10-10)
Comment 12 quickfire28 2023-04-27 03:50:43 UTC
(In reply to quickfire28 from comment #11)
> (In reply to quickfire28 from comment #10)
> > (In reply to David Cook from comment #9)
> > > I had the same thing happen recently and it was bad data.
> > > 
> > > You probably have '0000-00-00' in some of your date_renewed columns in the
> > > borrowers database table. Change those to NULL and you should be fine.
> > 
Sorry my bad there are lots of 0000-00-00 on date_renewed columns.

Thank you!
Comment 13 quickfire28 2023-04-27 04:40:34 UTC
Thanks! it is working fine now :)
Comment 14 Oleg Vasylenko 2024-08-12 13:30:20 UTC
I had the same problem and solved it with this code:
UPDATE borrowers SET date_renewed = NULL where date_renewed = "0000-00-00";

But lately I started receiving the same error 500 "Month out of range" on Koha 23.11. I checked if date_renewed contains wrong data but the problem was not with this column.

/var/log/koha/lib/plack-api-error.log showed me the problem:
[2024/08/12 16:15:44] [WARN] OpenAPI >>> GET api/v1/patrons [{"message":"Month out of range.","path":"\/body\/1\/last_seen"},{"message":"Month out of range.","path":"\/body\/12\/last_seen"},{"message":"Month out of range.","path":"\/body\/14\/last_seen"},{"message":"Month out of range.","path":"\/body\/16\/last_seen"},{"message":"Month out of range.","path":"\/body\/18\/last_seen"},{"message":"Month out of range.","path":"\/body\/19\/last_seen"},{"message":"Month out of range.","path":"\/body\/5\/last_seen"},{"message":"Month out of range.","path":"\/body\/7\/last_seen"},{"message":"Month out of range.","path":"\/body\/8\/last_seen"},{"message":"Month out of range.","path":"\/body\/9\/last_seen"}]

So the problem was with column last_seen. You can use this SQL to check for a possible problem with data:
SELECT count(*) FROM borrowers WHERE lastseen = "0000-00-00";

If this SQL returns 0, then there is no problem. If not, then you can solve it with SQL:
UPDATE borrowers SET lastseen = NULL where lastseen = "0000-00-00";