Skip to content

API returns "Internal Server Error" message with status code 200 for invalid payload #570

@harshit-webkul

Description

@harshit-webkul

Describe the bug
When sending an incorrect or invalid payload to the API, the response body correctly displays an error message such as:
"Internal server error"
However, the HTTP status code is still 200, which is incorrect.
The API should return a proper error status code (e.g., 400, 422, or 500) depending on the validation or server failure.

To Reproduce
Steps to reproduce the behavior:

  1. Pass an invalid/wrong payload (selectedConfigurableOption: 15, which is not available).
  2. Observe the response.

Expected behavior
API should return correct error status codes, such as:

  • 400 → Bad Request
  • 422 → Unprocessable Entity
  • 500 → Internal Server Error (if it fails internally)
    The status code should match the error displayed in the response body.

Actual Result:
Response body shows "Internal server error".
Status code remains 200, which indicates success even though the request failed.

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions