When upgrading, bot might return empty messages and cause a failure #3

Open
opened 2020-11-17 12:26:55 +01:00 by pablo.iranzo · 4 comments
pablo.iranzo commented 2020-11-17 12:26:55 +01:00 (Migrated from gitlab.com)
[VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: Sending a message caused network error:
[VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: Message text is empty
Traceback (most recent call last):
  File "/root/velasco/speaker.py", line 320, in say
    send(bot, cid, self.speech(reader), replying, logger=self.logger, **kwargs)
  File "/root/velasco/speaker.py", line 44, in send
    return bot.send_message(cid, text, **kwargs)
  File "<decorator-gen-2>", line 2, in send_message
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 78, in decorator
    result = func(*args, **kwargs)
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 382, in send_message
    return self._message('sendMessage', data,  # type: ignore[return-value]
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 215, in _message
    result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 184, in _post
    return self.request.post('{}/{}'.format(self.base_url, endpoint), data=data,
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 325, in post
    result = self._request_wrapper('POST', url,
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 250, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Message text is empty

Previous messages:

[VELASCOBOT][2020-11-17 12:25:22]__main__::ERROR: Vocabulary file ./chatlogs/chat_-$CHATID/record.vls not found.
[VELASCOBOT][2020-11-17 12:25:22]__main__::ERROR: UTF-16 stream does not start with BOM
Traceback (most recent call last):
  File "/root/velasco/archivist.py", line 74, in load_vocab
    record = file.read()
  File "/usr/lib64/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
  File "/usr/lib64/python3.9/encodings/utf_16.py", line 67, in _buffer_decode
    raise UnicodeError("UTF-16 stream does not start with BOM")
UnicodeError: UTF-16 stream does not start with BOM
[VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: Vocabulary file ./chatlogs/chat_$ANOTHERCHATID/record.vls not found.
[VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: 'utf-16-le' codec can't decode byte 0x7d in position 1178: truncated data
``` [VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: Sending a message caused network error: [VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: Message text is empty Traceback (most recent call last): File "/root/velasco/speaker.py", line 320, in say send(bot, cid, self.speech(reader), replying, logger=self.logger, **kwargs) File "/root/velasco/speaker.py", line 44, in send return bot.send_message(cid, text, **kwargs) File "<decorator-gen-2>", line 2, in send_message File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 78, in decorator result = func(*args, **kwargs) File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 382, in send_message return self._message('sendMessage', data, # type: ignore[return-value] File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 215, in _message result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs) File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 184, in _post return self.request.post('{}/{}'.format(self.base_url, endpoint), data=data, File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 325, in post result = self._request_wrapper('POST', url, File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 250, in _request_wrapper raise BadRequest(message) telegram.error.BadRequest: Message text is empty ``` Previous messages: ``` [VELASCOBOT][2020-11-17 12:25:22]__main__::ERROR: Vocabulary file ./chatlogs/chat_-$CHATID/record.vls not found. [VELASCOBOT][2020-11-17 12:25:22]__main__::ERROR: UTF-16 stream does not start with BOM Traceback (most recent call last): File "/root/velasco/archivist.py", line 74, in load_vocab record = file.read() File "/usr/lib64/python3.9/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) File "/usr/lib64/python3.9/encodings/utf_16.py", line 67, in _buffer_decode raise UnicodeError("UTF-16 stream does not start with BOM") UnicodeError: UTF-16 stream does not start with BOM [VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: Vocabulary file ./chatlogs/chat_$ANOTHERCHATID/record.vls not found. [VELASCOBOT][2020-11-17 12:25:30]__main__::ERROR: 'utf-16-le' codec can't decode byte 0x7d in position 1178: truncated data ```
pablo.iranzo commented 2020-11-17 12:35:44 +01:00 (Migrated from gitlab.com)

Seems not relevant to upgrading as I removed the chatlog folder and created an empty one and got this:

[VELASCOBOT][2020-11-17 12:35:10]__main__::ERROR: Sending a message caused network error:
[VELASCOBOT][2020-11-17 12:35:10]__main__::ERROR: Message text is empty
Traceback (most recent call last):
  File "/root/velasco/speaker.py", line 320, in say
    send(bot, cid, self.speech(reader), replying, logger=self.logger, **kwargs)
  File "/root/velasco/speaker.py", line 44, in send
    return bot.send_message(cid, text, **kwargs)
  File "<decorator-gen-2>", line 2, in send_message
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 78, in decorator
    result = func(*args, **kwargs)
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 382, in send_message
    return self._message('sendMessage', data,  # type: ignore[return-value]
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 215, in _message
    result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 184, in _post
    return self.request.post('{}/{}'.format(self.base_url, endpoint), data=data,
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 325, in post
    result = self._request_wrapper('POST', url,
  File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 250, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Message text is empty
[VELASCOBOT][2020-11-17 12:35:10]__main__::ERROR: Going mute for 60 seconds.
Seems not relevant to upgrading as I removed the chatlog folder and created an empty one and got this: ``` [VELASCOBOT][2020-11-17 12:35:10]__main__::ERROR: Sending a message caused network error: [VELASCOBOT][2020-11-17 12:35:10]__main__::ERROR: Message text is empty Traceback (most recent call last): File "/root/velasco/speaker.py", line 320, in say send(bot, cid, self.speech(reader), replying, logger=self.logger, **kwargs) File "/root/velasco/speaker.py", line 44, in send return bot.send_message(cid, text, **kwargs) File "<decorator-gen-2>", line 2, in send_message File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 78, in decorator result = func(*args, **kwargs) File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 382, in send_message return self._message('sendMessage', data, # type: ignore[return-value] File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 215, in _message result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs) File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/bot.py", line 184, in _post return self.request.post('{}/{}'.format(self.base_url, endpoint), data=data, File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 325, in post result = self._request_wrapper('POST', url, File "/root/velasco/.tox/velasco/lib/python3.9/site-packages/telegram/utils/request.py", line 250, in _request_wrapper raise BadRequest(message) telegram.error.BadRequest: Message text is empty [VELASCOBOT][2020-11-17 12:35:10]__main__::ERROR: Going mute for 60 seconds. ```
vylion commented 2021-01-22 20:29:06 +01:00 (Migrated from gitlab.com)

A Generator generates empty messages when the dictionary of words is empty. Is that your case? Either way, I think I had a check in place for that that I may have accidentally removed with the update. I added a new one, but I can't test it right now. I'm going to upload it soon, let me know if it fixes it.

A Generator generates empty messages when the dictionary of words is empty. Is that your case? Either way, I think I had a check in place for that that I may have accidentally removed with the update. I added a new one, but I can't test it right now. I'm going to upload it soon, let me know if it fixes it.
pablo.iranzo commented 2021-01-22 20:33:04 +01:00 (Migrated from gitlab.com)

I ended up removing the stale data and starting over, so I will not be able to check, if it not fails will be ok!

I ended up removing the stale data and starting over, so I will not be able to check, if it not fails will be ok!
vylion commented 2021-01-22 20:46:57 +01:00 (Migrated from gitlab.com)

assigned to @vylion

assigned to @vylion
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
vylion/velascobot#3
No description provided.