Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UAA returns JSON error responses with incorrect media type.

See original GitHub issue

What version of UAA are you running?


What output do you see from curl <YOUR_UAA>/info -H'Accept: application/json'?


How are you deploying the UAA?

I am deploying the UAA

  • locally only using gradlew

What did you do?

  • Download UAA 74.30.0 from GitHub
  • Run the UAA locally using ./gradlew run
  • Call (most?) APIs with an invalid query parameter or an invalid request body

What did you expect to see? What goal are you trying to achieve with the UAA?

In all cases, UAA returns a valid JSON response similar to this:

{"error_description":"Invalid filter expression: [foo] [created]","error":"scim","message":"Invalid filter expression: [foo] [created]"}{"error_description":"Invalid filter expression: [foo] [created]","error":"scim","message":"Invalid filter expression: [foo] [created]"}

The Content-Type response header should always be application/json to match this response body.

What did you see instead?

If we pass in different Accept request headers, the response Content-Type header changes. The response body is still in the JSON format above.

Accept request header Content-Type response header Valid
unspecified application/octet-stream;charset=ISO-8859-1 ✖️
*/* application/octet-stream;charset=ISO-8859-1 ✖️
application/json;charset=UTF-8 application/json;charset=UTF-8 ✔️
application/json application/json;charset=ISO-8859-1 ✔️1
application/json,*/* application/json;charset=ISO-8859-1 ✔️1
application/json,text/html application/json;charset=ISO-8859-1 ✔️1
*/*,application/json application/json;charset=ISO-8859-1 ✔️1
text/html,application/json text/html;charset=ISO-8859-1 ✖️
text/html,*/* text/html;charset=ISO-8859-1 ✖️

[1] The JSON format uses ISO-8859-1 encoding, but RFC 8259 restricts it to UTF-8. See for more information.

This issue does not seem to be restricted to a specific API. It was tested on the following APIs:

  • GET /v1/Users
  • PUT /v1/Users/{userId}
  • GET /v1/Groups
  • PUT /v1/Groups/{groupId}
  • POST /v1/Groups/{groupId}/members

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

metacubedcommented, Aug 30, 2021

Those handlers all seem to be using a ConvertingExceptionView to convert an ExceptionReport to the HTTP response. When the Accept header is absent or */*, that class tries to infer the response media type:

I think this might be a better place to add the fix, so it can be used for all response handling.

strehlecommented, Aug 31, 2021

I think this might be a better place to add the fix, so it can be used for all response handling.

ok for me, hope that not too many tests needs to be adopted

Read more comments on GitHub >

github_iconTop Results From Across the Web

UAA returns JSON error responses with incorrect media type.
Read more >
Overview – UAA API Reference - Cloud Foundry Documentation
The passed string has to be a URL-Encoded JSON Object, containing the field origin with value as origin_key of an identity provider. Note...
Read more >
What are Duo's API responses and error messages?
API responses are formatted as a JSON object with a top-level stat key. Successful responses will have a stat value of “OK” and...
Read more > WMS: RESTful API (UAA) - OpenWMS on GitHub
Beside the actual representation of resources, the server may result an error response in JSON format that contains basic information about the error...
Read more >
SMAPI Error Codes | Alexa Skills Kit - Amazon Developer
When a problem occurs, SMAPI returns an HTTP response with a 4xx or 5xx HTTP status code. Some of these error ... smallIconUri\"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found