# NullPointerException when searching for a patient by identifier

**URL:** <https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622>\
**Category:** Development\
**Tags:** core, o3\
**Created:** [January 15, 2025, 9:59am UTC](https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622 "2025-01-15T09:59:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnsereko](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jnsereko/32/14978_2.png) [@jnsereko](https://talk.openmrs.org/u/jnsereko)\
**Post date:** [January 15, 2025, 9:59am UTC](https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622/1 "2025-01-15T09:59:15Z")

</div>

Our instance errors on searching for patients by Identifier. We are running OpenMRS version `2.6.7 Build 0686d8`  
See attached files and the error log [here](https://pastebin.com/6z9v2Kdf)

Could you know how to solve this?

 ![Screenshot 2025-01-14 at 20.12.11](https://talk.openmrs.org/uploads/default/original/3X/2/f/2f55b6aed3f2c080536d1d180caefc8e20da2692.png)

… in addition, i have also asked this on [slack](https://openmrs.slack.com/archives/C02UNMKFH8V/p1736920572205359)

cc @dkayiwa @ibacher

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [January 15, 2025, 12:40pm UTC](https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622/2 "2025-01-15T12:40:44Z")

</div>

The server log would probably be more helpful in helping you.

---

<div class="post-metadata">

**Author:** ![jnsereko](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jnsereko/32/14978_2.png) [@jnsereko](https://talk.openmrs.org/u/jnsereko)\
**Post date:** [January 15, 2025, 2:00pm UTC](https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622/3 "2025-01-15T14:00:03Z")

</div>

Thank you @ibacher.

[Here](https://pastebin.com/EAfkBxQ0) is the log form the server on executing the request.

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [January 15, 2025, 4:56pm UTC](https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622/4 "2025-01-15T16:56:07Z")

</div>

I was sort of hoping for more than just that exception… The problem seems to be that patient is null [at this line](https://github.com/openmrs/openmrs-module-webservices.rest/blob/381dae8fa1128d8c38178a6a32a35a08701b5f1a/omod-1.11/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/search/openmrs1_11/LivingPatientSearchHandler1_11.java#L62), but I don’t really have any insight into why that might be.

Maybe try rebuilding the search index?

---

<div class="post-metadata">

**Author:** ![jnsereko](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jnsereko/32/14978_2.png) [@jnsereko](https://talk.openmrs.org/u/jnsereko)\
**Post date:** [January 15, 2025, 8:42pm UTC](https://talk.openmrs.org/t/nullpointerexception-when-searching-for-a-patient-by-identifier/44622/5 "2025-01-15T20:42:48Z")

</div>

> Maybe try rebuilding the search index?

This has actually fixed the issue @ibacherThank you
