Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error sometimes when bot sending a message #67

Open
kroryan opened this issue Sep 20, 2024 · 2 comments
Open

error sometimes when bot sending a message #67

kroryan opened this issue Sep 20, 2024 · 2 comments

Comments

@kroryan
Copy link

kroryan commented Sep 20, 2024

so i get an error sometimes when the bot try to answer:

[OllamaAPI-ERR] CAUGHT FAULT!
Traceback (most recent call last):
File "/home/orangepi/ollama-telegram/bot/run.py", line 270, in ollama_request
if await handle_response(message, response_data, full_response):
File "/home/orangepi/ollama-telegram/bot/run.py", line 225, in handle_response
await send_response(message, text)
File "/home/orangepi/ollama-telegram/bot/run.py", line 240, in send_response
await bot.send_message(chat_id=message.chat.id, text=text,parse_mode=ParseMode.MARKDOWN)
File "/home/orangepi/.local/lib/python3.9/site-packages/aiogram/client/bot.py", line 2718, in send_message
return await self(call, request_timeout=request_timeout)
File "/home/orangepi/.local/lib/python3.9/site-packages/aiogram/client/bot.py", line 432, in call
return await self.session(self, method, timeout=request_timeout)
File "/home/orangepi/.local/lib/python3.9/site-packages/aiogram/client/session/base.py", line 257, in call
return cast(TelegramType, await middleware(bot, method))
File "/home/orangepi/.local/lib/python3.9/site-packages/aiogram/client/session/aiohttp.py", line 179, in make_request
response = self.check_response(
File "/home/orangepi/.local/lib/python3.9/site-packages/aiogram/client/session/base.py", line 120, in check_response
raise TelegramBadRequest(method=method, message=description)
aiogram.exceptions.TelegramBadRequest: Telegram server says - Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 702

do you know what i can do about it?

it only happens sometimes not always i dont understand very well what is going on

@kroryan
Copy link
Author

kroryan commented Sep 20, 2024

it looks like its relate of using "?" or others symbols, not sure

@sebaxakerhtc
Copy link

sebaxakerhtc commented Oct 31, 2024

Same here

First of all - THANK YOU !!!

2024-10-31 20:56:48 ollama-tg  | INFO:root:[OllamaAPI]: Processing 'Расскажи о нашей группе' for sebaxakerhtc None
2024-10-31 20:57:01 ollama-tg  | -----
2024-10-31 20:57:01 ollama-tg  | [OllamaAPI-ERR] CAUGHT FAULT!
2024-10-31 20:57:01 ollama-tg  | Traceback (most recent call last):
2024-10-31 20:57:01 ollama-tg  |   File "/code/run.py", line 351, in ollama_request
2024-10-31 20:57:01 ollama-tg  |     if await handle_response(message, response_data, full_response):
2024-10-31 20:57:01 ollama-tg  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-31 20:57:01 ollama-tg  |   File "/code/run.py", line 304, in handle_response
2024-10-31 20:57:01 ollama-tg  |     await send_response(message, text)
2024-10-31 20:57:01 ollama-tg  |   File "/code/run.py", line 319, in send_response
2024-10-31 20:57:01 ollama-tg  |     await bot.send_message(chat_id=message.chat.id, text=text,parse_mode=ParseMode.MARKDOWN)
2024-10-31 20:57:01 ollama-tg  |   File "/usr/local/lib/python3.12/site-packages/aiogram/client/bot.py", line 2917, in send_message
2024-10-31 20:57:01 ollama-tg  |     return await self(call, request_timeout=request_timeout)
2024-10-31 20:57:01 ollama-tg  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-31 20:57:01 ollama-tg  |   File "/usr/local/lib/python3.12/site-packages/aiogram/client/bot.py", line 488, in __call__
2024-10-31 20:57:01 ollama-tg  |     return await self.session(self, method, timeout=request_timeout)
2024-10-31 20:57:01 ollama-tg  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-31 20:57:01 ollama-tg  |   File "/usr/local/lib/python3.12/site-packages/aiogram/client/session/base.py", line 254, in __call__
2024-10-31 20:57:01 ollama-tg  |     return cast(TelegramType, await middleware(bot, method))
2024-10-31 20:57:01 ollama-tg  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-31 20:57:01 ollama-tg  |   File "/usr/local/lib/python3.12/site-packages/aiogram/client/session/aiohttp.py", line 189, in make_request
2024-10-31 20:57:01 ollama-tg  |     response = self.check_response(
2024-10-31 20:57:01 ollama-tg  |                ^^^^^^^^^^^^^^^^^^^^
2024-10-31 20:57:01 ollama-tg  |   File "/usr/local/lib/python3.12/site-packages/aiogram/client/session/base.py", line 120, in check_response
2024-10-31 20:57:01 ollama-tg  |     raise TelegramBadRequest(method=method, message=description)
2024-10-31 20:57:01 ollama-tg  | aiogram.exceptions.TelegramBadRequest: Telegram server says - Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 1504
2024-10-31 20:57:01 ollama-tg  | 
2024-10-31 20:57:01 ollama-tg  | -----
2024-10-31 20:57:01 ollama-tg  | INFO:aiogram.event:Update id=83927814 is handled. Duration 13295 ms by bot id=7567523847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants