Skip to main content

Fixed: "This predictor only supports the following content types ... Got 'application/csv'" in MLflow

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

I sent a CSV file to an MLflow model server with the Content-Type: application/csv header that MLflow's own guide uses, and the server answered 415 Unsupported Media Type: This predictor only supports the following content types: Types: ['text/csv', 'application/json', 'application/vnd.apache.parquet']. Got 'application/csv'. The server reads CSV only when the request says text/csv, and changing the header fixed it.

What I Was Doing​

In Part 9 of the MLflow series, I served the shopper project's champion model on my Mac with mlflow models serve on port 5001, using MLflow 3.18.0. The project has a CSV file of three online shopping sessions, examples/sessions.csv, and I wanted the model's predictions for it.

MLflow's guide to deploying a model as a local inference server says how to send CSV:

The /invocations endpoint accepts CSV or JSON inputs. The input format must be specified in the Content-Type header as either application/json or application/csv.

and gives this example:

From MLflow's guide
curl http://127.0.0.1:5000/invocations -H 'Content-Type: application/csv' --data '1,2,3,4'

So I sent the file with that header, from a second terminal in the project folder. --data-binary sends the file exactly as it is, line breaks included:

Terminal 2
curl -i http://127.0.0.1:5001/invocations -H "Content-Type: application/csv" --data-binary @examples/sessions.csv

What I Expected​

The model's predictions for the three sessions, as JSON.

What I Got​

Output
HTTP/1.1 415 Unsupported Media Type
date: Thu, 26 Nov 2026 05:23:09 GMT
server: uvicorn
content-length: 155
content-type: text/plain; charset=utf-8

This predictor only supports the following content types: Types: ['text/csv', 'application/json', 'application/vnd.apache.parquet']. Got 'application/csv'.

curl's output in a terminal: HTTP/1.1 415 Unsupported Media Type from uvicorn, and the message This predictor only supports the following content types: text/csv, application/json and application/vnd.apache.parquet, Got application/csv.

415 Unsupported Media Type means the server refused the request because of its Content-Type label, before it looked at the data.

What I Checked​

The message lists the accepted types: text/csv, application/json and application/vnd.apache.parquet. application/csv isn't one of them.

MLflow's scoring server says the same. In MLflow 3.18.0, mlflow/pyfunc/scoring_server/__init__.py defines the three types and compares the request's type with them exactly:

mlflow/pyfunc/scoring_server/__init__.py (MLflow 3.18.0, excerpt)
CONTENT_TYPE_CSV = "text/csv"
CONTENT_TYPE_JSON = "application/json"
CONTENT_TYPE_PARQUET = "application/vnd.apache.parquet"
mlflow/pyfunc/scoring_server/__init__.py (MLflow 3.18.0, excerpt)
if mime_type == CONTENT_TYPE_CSV:

So the guide's application/csv can't match.

Why It Happens​

The server picks a reader for the body from the Content-Type header: text/csv for CSV, application/json for JSON and application/vnd.apache.parquet for Parquet. Any other type gets 415 before the data is read. MLflow's guide names application/csv, which the server doesn't accept, so its CSV example can't work as written.

The Fix​

Send CSV as text/csv:

Terminal 2
curl -i http://127.0.0.1:5001/invocations -H "Content-Type: text/csv" --data-binary @examples/sessions.csv

After the Fix​

Output
HTTP/1.1 200 OK
date: Thu, 26 Nov 2026 05:23:10 GMT
server: uvicorn
content-length: 148
content-type: application/json

{"predictions": [[0.10694143736565398, 0.893058562634346], [0.999142902134051, 0.0008570978659490101], [0.9966742334522005, 0.0033257665477994395]]}

curl's output in a terminal: HTTP/1.1 200 OK and the predictions as JSON pairs, the second number in each 0.893, 0.0009 and 0.0033.

The server read the CSV and answered with one pair of probabilities per session, not buying and buying. The whole numbers in the file, such as 3 page visits, were fine: the server reads a CSV body with the column types in the model's signature.

Common Mistakes​

MistakeWhat happensDo this instead
Content-Type: application/csv, as in MLflow's guide415 Unsupported Media TypeContent-Type: text/csv
--data @file.csv instead of --data-binarycurl removes the line breaks, so the rows run together--data-binary @file.csv
No Content-Type header with --datacurl labels it application/x-www-form-urlencoded, which is also a 415Always set the header

Troubleshooting​

SymptomLikely causeFix
Got 'application/x-www-form-urlencoded'The request has no Content-Type headerAdd -H "Content-Type: text/csv"
Incompatible input types for column ... from mlflow models predict -t csvThe command line reads CSV without the signature's typesUse JSON there: Fixed: Incompatible input types for column

FAQ​

Which formats does the server accept?​

JSON, in one of MLflow's layouts such as dataframe_split, CSV as text/csv, and Parquet as application/vnd.apache.parquet: How to Send a CSV File to an MLflow Model Server and How to Send a Parquet File to an MLflow Model Server.

Is the CLI's CSV different?​

Yes. mlflow models predict -t csv reads the file without the signature's column types, so whole numbers in a decimal column stop it, while the server reads the same file without trouble.

Conclusion​

MLflow's model server reads CSV only when the request says Content-Type: text/csv, and answers 415 for the application/csv that MLflow's guide uses. With text/csv, the same file got the three sessions' predictions.

Additional Resources​