Callback channel throws AttributeError: 'NoneType' object has no attribute 'startswith'
See original GitHub issueRasa Open Source version
2.8.11
Rasa SDK version
2.8.2
Rasa X version
No response
Python version
3.8
What operating system are you using?
Linux
What happened?
Sending a request to webhooks/callback/webhook
throws the following exception in the rasa server logs:
2021-10-21 14:51:17 ERROR rasa.core.channels.rest - An exception occured while handling user message 'None'.
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/rest.py", line 120, in receive
await on_new_message(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/channel.py", line 89, in handler
await app.agent.handle_message(message)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 577, in handle_message
return await processor.handle_message(message)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 96, in handle_message
tracker = await self.log_message(message, should_save_tracker=False)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 327, in log_message
await self._handle_message_with_tracker(message, tracker)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 594, in _handle_message_with_tracker
parse_data = await self.parse_message(message, tracker)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 567, in parse_message
if text.startswith(INTENT_MESSAGE_PREFIX):
AttributeError: 'NoneType' object has no attribute 'startswith'
Command / Request
1. Run rasa init
2. Enable the rest and callback channel in credentials.yml. Set the config for the callback channel to:
callback:
url: http://localhost:5005/webhooks/rest/webhook
3. Run rasa train
4. Run rasa run --enable-api -vv
5. Run:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"sender":"test_user", "message":"/greet"}' \
http://localhost:5005/webhooks/callback/webhook
Relevant log output
2021-10-21 14:51:16 DEBUG rasa.core.processor - Received user message 'hello world' with intent '{'id': -9191520425337906859, 'name': 'greet', 'confidence': 0.8585400581359863}' and entities '[]'
2021-10-21 14:51:16 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 14 events.
2021-10-21 14:51:16 DEBUG rasa.core.policies.memoization - Current tracker state:
[state 0] user intent: greet | previous action name: action_listen
[state 1] user intent: greet | previous action name: utter_greet
[state 2] user intent: greet | previous action name: action_listen
[state 3] user intent: greet | previous action name: utter_greet
[state 4] user intent: greet | previous action name: action_listen
2021-10-21 14:51:16 DEBUG rasa.core.policies.memoization - There is no memorised next action
2021-10-21 14:51:17 DEBUG rasa.core.policies.ted_policy - TED predicted 'utter_greet' based on user intent.
2021-10-21 14:51:17 DEBUG rasa.core.policies.rule_policy - Current tracker state:
[state 1] user intent: greet | previous action name: action_listen
[state 2] user intent: greet | previous action name: utter_greet
[state 3] user intent: greet | previous action name: action_listen
[state 4] user intent: greet | previous action name: utter_greet
[state 5] user text: hello world | previous action name: action_listen
2021-10-21 14:51:17 DEBUG rasa.core.policies.rule_policy - There is no applicable rule.
2021-10-21 14:51:17 DEBUG rasa.core.policies.rule_policy - Current tracker state:
[state 1] user intent: greet | previous action name: action_listen
[state 2] user intent: greet | previous action name: utter_greet
[state 3] user intent: greet | previous action name: action_listen
[state 4] user intent: greet | previous action name: utter_greet
[state 5] user intent: greet | previous action name: action_listen
2021-10-21 14:51:17 DEBUG rasa.core.policies.rule_policy - There is a rule for the next action 'utter_greet'.
2021-10-21 14:51:17 DEBUG rasa.core.policies.ensemble - Made prediction using user intent.
2021-10-21 14:51:17 DEBUG rasa.core.policies.ensemble - Added `DefinePrevUserUtteredFeaturization(False)` event.
2021-10-21 14:51:17 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_2_RulePolicy.
2021-10-21 14:51:17 DEBUG rasa.core.processor - Predicted next action 'utter_greet' with confidence 1.00.
2021-10-21 14:51:17 DEBUG rasa.core.processor - Policy prediction ended with events '[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x7f77f458c8e0>]'.
2021-10-21 14:51:17 DEBUG rasa.core.processor - Action 'utter_greet' ended with events '[BotUttered('Hey! How are you?', {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, {"utter_action": "utter_greet"}, 1634827877.2163692)]'.
2021-10-21 14:51:17 DEBUG rasa.core.lock_store - Issuing ticket for conversation 'default'.
2021-10-21 14:51:17 DEBUG rasa.core.lock_store - Acquiring lock for conversation 'default'.
2021-10-21 14:51:17 DEBUG rasa.core.lock_store - Acquired lock for conversation 'default'.
2021-10-21 14:51:17 DEBUG rasa.core.tracker_store - Recreating tracker for id 'default'
2021-10-21 14:51:17 DEBUG rasa.core.processor - Starting a new session for conversation ID 'default'.
2021-10-21 14:51:17 DEBUG rasa.core.processor - Policy prediction ended with events '[]'.
2021-10-21 14:51:17 DEBUG rasa.core.processor - Action 'action_session_start' ended with events '[<rasa.shared.core.events.SessionStarted object at 0x7f76f7e63760>, ActionExecuted(action: action_listen, policy: None, confidence: None)]'.
2021-10-21 14:51:17 DEBUG rasa.core.processor - Current slot values:
session_started_metadata: None
2021-10-21 14:51:17 DEBUG rasa.core.lock_store - Deleted lock for conversation 'default'.
2021-10-21 14:51:17 ERROR rasa.core.channels.rest - An exception occured while handling user message 'None'.
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/rest.py", line 120, in receive
await on_new_message(
File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/channel.py", line 89, in handler
await app.agent.handle_message(message)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 577, in handle_message
return await processor.handle_message(message)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 96, in handle_message
tracker = await self.log_message(message, should_save_tracker=False)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 327, in log_message
await self._handle_message_with_tracker(message, tracker)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 594, in _handle_message_with_tracker
parse_data = await self.parse_message(message, tracker)
File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 567, in parse_message
if text.startswith(INTENT_MESSAGE_PREFIX):
AttributeError: 'NoneType' object has no attribute 'startswith'
Definition of done
- Investigate issue
- Fix bug if straightforward
- Otherwise: Create issue for problem if it is too complicated
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
'NoneType' object has no attribute 'startswith' - Stack Overflow
In the first line of code, you are getting the attribute error because the code assumes that job contains a string, which has...
Read more >Custom Channel Error 'NoneType' object has no attribute ...
Hi I am tryind to use the custom channel implementation from rasa docs getting below error while hitting from postman.
Read more >Getting error '_io.BufferedReader' object has no attribute ...
Coding example for the question Getting error '_io.BufferedReader' object has no attribute 'startswith' while uploading local image on a webhook's avatar.
Read more >'NoneType' object has no attribute 'startswith' - Bugzilla@Mozilla
[traceback] AttributeError: 'NoneType' object has no attribute 'startswith'.
Read more >API Reference - discord.py - Read the Docs
... is not found. Usually if this is thrown then there is a Discord API outage. ... Forbidden – You do not have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Could be related to https://github.com/RasaHQ/rasa/issues/10504 ?
@carlad and I had a call and agreed that setting:
is a usage error.
The smart device should send the notification directly to the input/output channel.