Open Source API Gateway

500 Internal Server Error: Error Validating Message

Membrane API Gateway returns 500 Internal Server Error with the detail Error validating message when the JSON Schema validator throws an unexpected exception while it validates a request or response. This is not a validation failure, and it usually indicates a bug in Membrane.

The Error Response

The response contains the status 500 Internal Server Error, the detail Error validating message, the problem type https://membrane-api.io/problems/internal and a link to this page. The internal validator field names the validator. The type internal means that the gateway could not complete the processing of the message. In production mode, the title is replaced by Internal Server Error and the details are left out.

Which Validator Is Affected

The URL of this page names the JSON Schema validator, which is a validator with a jsonSchema:

api:
port: 2000
flow:
- validator:
jsonSchema: order.schema.json
target:
url: https://api.predic8.de
api:
  port: 2000
  flow:
    - validator:
        jsonSchema: order.schema.json
  target:
    url: https://api.predic8.de

A message that does not match its schema is rejected with a validation error that lists the violations, and a body that cannot be read is reported as a body read error. Neither leads to this page.

Common Causes

An Unexpected Error in the Validation

An exception occurred inside the validation code or in the JSON Schema library, and the validator does not handle it. No concrete trigger is known, so treat this error as a bug in Membrane or in the library.

How to Fix It

  1. Enable development mode, or check the gateway log. In production, use the log key of the response to find the entry. The validator logs the full stack trace at error level.
  2. Report the problem on GitHub Issues with the stack trace, the validator configuration and, if possible, a synthetic message that reproduces it.

Hide Details in Production

By default, Membrane runs in development mode and adds details to error responses that help you find the problem. These details may reveal information about your setup. In production, turn them off:

configuration:
production: true
configuration:
  production: true

Add the configuration document to your apis.yaml and separate it from the APIs with ---. The title then reads Internal Server Error, and the details and the link to this page are left out. If the response contains a log key, search the gateway log for it to find the full error message.

Related Documentation

Configuration reference:

Tutorials with runnable examples:

← All Membrane error messages

Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.