Rasa nlu server 500 Error

Hi, I started the nlu server by typing this command in cmd:

rasa run --enable-api -m models/(name of my package).tar

and then in other cmd window typed:

curl localhost:5005/model/parse -d ‘{“text”:“hello”}’

after that I got an error:

{“version”:“1.2.3”,“status”:“failure”,“message”:“An unexpected error occurred. Error: Failed when parsing body as json”,“reason”:“ParsingError”,“details”:{},“help”:null,“code”:500}

What is the reason for it? what should I change to get the normal(200) output?

Can you do the same in debug mode, e.g.

rasa run --enable-api -m models/(name of my package).tar --debug

You should see the stacktrace of the actual exception in debug mode. Can you past it here?

I have seen the same issue when I run the server also. I use RASA 1.3

Ran my NLU server:

(RASA_ENV_python3.6) D:\ML-Chatbot-Cudo\RASA_ENV_python3.6>rasa run --enable-api
 -m models/nlu-20190825-161838.tar.gz --debug
2019-08-25 17:24:18 DEBUG    rasa.cli.utils  - Parameter 'endpoints' not set. Us
ing default location 'endpoints.yml' instead.
2019-08-25 17:24:18 DEBUG    rasa.cli.utils  - Parameter 'credentials' not set.
Using default location 'credentials.yml' instead.
2019-08-25 17:24:30 INFO     numexpr.utils  - NumExpr defaulting to 4 threads.
2019-08-25 17:24:35 DEBUG    rasa.core.utils  - Available web server routes:
/conversations/<conversation_id>/messages          POST
  add_message
/conversations/<conversation_id>/tracker/events    POST
  append_events
/webhooks/rasa                                     GET
  custom_webhook_RasaChatInput.health
/webhooks/rasa/webhook                             POST
  custom_webhook_RasaChatInput.receive
/webhooks/rest                                     GET
  custom_webhook_RestInput.health
/webhooks/rest/webhook                             POST
  custom_webhook_RestInput.receive
/model/test/intents                                POST
  evaluate_intents
/model/test/stories                                POST
  evaluate_stories
/conversations/<conversation_id>/execute           POST
  execute_action
/domain                                            GET
  get_domain
/                                                  GET
  hello
/model                                             PUT
  load_model
/model/parse                                       POST
  parse
/conversations/<conversation_id>/predict           POST
  predict
/conversations/<conversation_id>/tracker/events    PUT
  replace_events
/conversations/<conversation_id>/story             GET
  retrieve_story
/conversations/<conversation_id>/tracker           GET
  retrieve_tracker
/status                                            GET
  status
/model/predict                                     POST
  tracker_predict
/model/train                                       POST
  train
/model                                             DELETE
  unload_model
/version                                           GET
  version
2019-08-25 17:24:35 INFO     root  - Starting Rasa server on http://localhost:50
05
2019-08-25 17:24:35 INFO     root  - Enabling coroutine debugging. Loop id 39884
5320.
2019-08-25 17:24:35 DEBUG    rasa.model  - Extracted model to 'C:\Users\arvarma\
AppData\Local\Temp\tmpq1kptth7'.
2019-08-25 17:24:37 DEBUG    rasa.core.tracker_store  - Connected to InMemoryTra
ckerStore.
2019-08-25 17:24:37 DEBUG    rasa.model  - Extracted model to 'C:\Users\arvarma\
AppData\Local\Temp\tmpzg9apdmf'.

Now when I run the parse command using curl

curl http://localhost:5005/model/parse -d '{"text":"hello"}'
{"version":"1.3","status":"failure","message":"An unexpected error occurred. Err
or: Failed when parsing body as json","reason":"ParsingError","details":{},"help
":null,"code":500}

Error in console:

2019-08-25 17:25:58 DEBUG    rasa.server  - Traceback (most recent call last):
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\site-packages\sanic\request.py
 line 149, in load_json
    self.parsed_json = loads(self.body)
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\json\__init__.py", line 354, i
loads
    return _default_decoder.decode(s)
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\json\decoder.py", line 339, in
ecode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\json\decoder.py", line 357, in
aw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\ml-chatbot-cudo\rasa_env_python3.6\rasa\rasa\server.py", line 823,
 parse
    data = emulator.normalise_request_json(request.json)
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\site-packages\sanic\request.py
 line 143, in json
    self.load_json()
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\site-packages\sanic\request.py
 line 153, in load_json
    raise InvalidUsage("Failed when parsing body as json")
sanic.exceptions.InvalidUsage: Failed when parsing body as json

2019-08-25 17:29:21 DEBUG    rasa.server  - Traceback (most recent call last):
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\site-packages\sanic\request.py
 line 149, in load_json
    self.parsed_json = loads(self.body)
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\json\__init__.py", line 354, i
loads
    return _default_decoder.decode(s)
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\json\decoder.py", line 339, in
ecode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\json\decoder.py", line 357, in
aw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\ml-chatbot-cudo\rasa_env_python3.6\rasa\rasa\server.py", line 823,
 parse
    data = emulator.normalise_request_json(request.json)
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\site-packages\sanic\request.py
 line 143, in json
    self.load_json()
  File "D:\Anaconda\envs\RASA_ENV_python3.6\lib\site-packages\sanic\request.py
 line 153, in load_json
    raise InvalidUsage("Failed when parsing body as json")
sanic.exceptions.InvalidUsage: Failed when parsing body as json

Does the same happen if you create a new chatbot with rasa init --no-prompt? I don’t have that problem on the latest version, can you update your Rasa version and try again?