By using AWS re:Post, you agree to the Terms of Use

An error occurred (ModelError) when calling the InvokeEndpoint operation


I received the following error message when I tried to send an array to my model:

An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from container-1 with message "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p> ". See

I have created inference pipeline containing preprocessing and autoencoder model and deployed it to a single endpoint. Am trying to send raw data in text/csv format. EX: "39, 4, 9, 8, contact"

Please help me out in this.

Much appreciated,

asked a year ago404 views
1 Answers


So the issue here is most likely with your inference code and how you are parsing/transforming the data coming in. Your endpoint is up and running but the format in which you are feeding it data is confusing it. The endpoint is expecting encoded data thus you need to convert your payload into the appropriate data format, there are two manners in which you can approach this.

  1. Use a serializer, when creating your endpoint with the predictor class you want to use the SageMaker Serializer to automatically encode/decode your data, this is configured while creating your endpoint. Look at the following code snippet below.

from sagemaker.predictor import csv_serializer
rf_pred = rf.deploy(1, "ml.m4.xlarge", serializer=csv_serializer)

#for prediction, decode the data properly

  1. If you choose not to use the serializer you want to encode the data on your own using something such as json.dumps(payload) to encode your data properly before sending the data to the endpoint.

Extra Resources:
SageMaker Serializers:

Hope this helps!

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions

Relevant questions