# 400 error attempting to retrieve ehrBySubjectId api

**URL:** <https://discourse.openehr.org/t/400-error-attempting-to-retrieve-ehrbysubjectid-api/4532>\
**Category:** Platform\
**Tags:** ehrbase\
**Created:** [12 October 2023 03:08 UTC](https://discourse.openehr.org/t/400-error-attempting-to-retrieve-ehrbysubjectid-api/4532 "2023-10-12T03:08:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrwilde](https://discourse.openehr.org/user_avatar/discourse.openehr.org/mrwilde/32/2807_2.png) [@mrwilde](https://discourse.openehr.org/u/mrwilde)\
**Post date:** [12 October 2023 03:08 UTC](https://discourse.openehr.org/t/400-error-attempting-to-retrieve-ehrbysubjectid-api/4532/1 "2023-10-12T03:08:34Z")

</div>

Working with a new integration I have come across a sporadic issue that I need assistance identifying the cause.

recently updated to using ehrBase 0.30.0

The error is

```auto
{
  "error": "Bad Request",
  "message": "Could not retrieve EHR for party:22108b3f-b1ae-4d30-ac65-169593fd5253 exception:java.lang.IllegalArgumentException: Cannot translate a null SQLException"
}

```

this happens when the external service uses the ehrBase API to get the EHR summary by subjectId

```auto
/ehrbase/rest/openehr/v1/ehr?subject_id=2b61ec68-a5b1-45d8-9562-b7807e6e4f0e&subject_namespace=development-domain-com

```

on inspection of the ehrbase party\_identified table I discovered duplicate `party_ref_value` & `party_ref_namespace`

I would have believed this to be not possible and I cannot replicate this using the API with swagger endpoint in ehrBase.

There is no direct documentation suggesting there should only be one so I am interested to know if anyone else has seen this happen.

Happy to share any information details
