Bug 40065 - Search for patron - error
Summary: Search for patron - error
Status: RESOLVED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-04 03:50 UTC by Igor A. Sychev
Modified: 2025-09-02 07:27 UTC (History)
5 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor A. Sychev 2025-06-04 03:50:44 UTC
When searching for "Search for patron", the message "502: error" is returned.

/cgi-bin/koha/members/members-home.pl

1. Result - 502: error
Search: Остапенко
Search field: Standard

2. Patrons found for: Standard starting with 'Остап'
Search: Остап
Search field: Standard

Result:
Остапенко, Эвелина
Шимко, Остап

3. Patrons found for: Surname starting with 'Остапенко'
Search: Остапенко
Search field: Surname

Result:
Остапенко, Эвелина
Comment 1 Jonathan Druart 2025-06-04 07:30:41 UTC
502 is "bad gateway". Did you restart the services (memcached, apache2, koha-common)?
Comment 2 Katrin Fischer 2025-06-04 11:12:50 UTC
Also: which version of Koha?
Comment 3 David Nind 2025-06-04 11:15:38 UTC
I can't replicate on the current main (using koha-testing-docker).
Comment 4 Igor A. Sychev 2025-06-05 02:12:29 UTC
I was restarting all the services. I also did a reboot.
24.11.03  
25.05.00
Comment 5 Igor A. Sychev 2025-06-05 08:14:10 UTC
4. Patrons found for: Standard starting with 'Сычев'

Result: 
Сычев, Игорь Алексеевич
Сычева, Анастасия Андреевна

Assumption. 
The error occurs if only one patron is found in the search results.
Comment 6 Igor A. Sychev 2025-08-22 08:09:53 UTC
Update Koha 24.11.07 and 25.05.02
Perhaps some data is missing? 
What should I pay attention to?
Comment 7 David Nind 2025-08-29 23:40:29 UTC
For what it is worth (and I don't know the answer to why this is happening), testing on the current main using koha-testing-docker:

1. I created these patrons in the 'Patron' category (no other data added, apart from adding a card number):
   1.1 Surname = Остапенко
   1.2 Surname = Остапенко Firstname = Эвелина
   1.3 Surname = Шимко Firstname = Остап
   1.4 Surname = Сычев Firstname = Игорь Алексеевич
   1.5 Surname = Сычева Firstname = Анастасия Андреевна

2. The DefaultPatronSearchFields system preference is set to the default: "firstname|preferred_name|middle_name|surname|othernames|cardnumber|userid" 

3. If I do the first search in the description comment, I get a 500 server error in a pop-up window and a "Processing..." message.

Search result, using the search in the sidebar with Search field = as per search, Search type = Starts with, Category =Any, Library = Any):

Search:
   - Search: Остапенко
   - Search field: Standard

Result - pop-up message: 
  Something went wrong when loading the table.
  500: Internal Server Error.
  Expected integer - got boolean.
  Expected integer - got boolean.

Browser developer tools console error:
  Got 500 (Internal Server Error)
  DataTables warning: table id=memberresultst - Ajax error. For more information about this error, please see https://datatables.net/tn/7

Error logs:
  ==> /var/log/koha/kohadev/plack-api-error.log <==
  [2025/08/29 23:15:43] [WARN] OpenAPI >>> GET api/v1/patrons [{"message":"Expected integer - got boolean.","path":"\/body\/0\/privacy_guarantor_checkouts"},{"message":"Expected integer - got boolean.","path":"\/body\/1\/privacy_guarantor_checkouts"}]

I get similar messages for the other searches, except there may be more "Expected integer - got boolean" messages.
Comment 8 Jonathan Druart 2025-09-01 12:28:57 UTC
(In reply to David Nind from comment #7)
> Error logs:
>   ==> /var/log/koha/kohadev/plack-api-error.log <==
>   [2025/08/29 23:15:43] [WARN] OpenAPI >>> GET api/v1/patrons
> [{"message":"Expected integer - got
> boolean.","path":"\/body\/0\/privacy_guarantor_checkouts"},{"message":
> "Expected integer - got
> boolean.","path":"\/body\/1\/privacy_guarantor_checkouts"}]

This should be fixed by

commit aea3b3c7002630489190fe6ea582757e1497b692

    Bug 39835: (follow-up) Fix API specs to check for boolean
    

modified: api/v1/swagger/definitions/patron.yaml

@ api/v1/swagger/definitions/patron.yaml:323 @ properties:
     type: integer
     description: patron's privacy settings related to their checkout history
   privacy_guarantor_checkouts:
-    type: integer
+    type: boolean

Can you confirm you get this error even after `yarn api:bundle && restart_all`?
Comment 9 David Nind 2025-09-01 19:46:52 UTC
I can't replicate the error at all today, I even tried on 24.11.x!
Comment 10 Jonathan Druart 2025-09-02 07:27:56 UTC
Closing, please reopen if still valid.