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

[Bug] on_turn_error: unhandled error: 'text' #2210

Open
frankqianms opened this issue Feb 27, 2025 · 0 comments
Open

[Bug] on_turn_error: unhandled error: 'text' #2210

frankqianms opened this issue Feb 27, 2025 · 0 comments
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.

Comments

@frankqianms
Copy link

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

latest

Describe the bug

Using botbuilder-python and teams-ai SDK to build a Teams bot with AI response. When sideloading the bot in the M365 Copilot, on_turn_error will occur if trying to conversation with the bot.
Linked issue: microsoft/teams-ai#2326

To Reproduce

repro-noresponse-in-copilot.mp4
[on_turn_error] unhandled error: 'text'
Traceback (most recent call last):
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\bot_adapter.py", line 174, in run_pipeline
    return await self._middleware.receive_activity_with_status(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\middleware_set.py", line 69, in receive_activity_with_status
    return await self.receive_activity_internal(context, callback)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\middleware_set.py", line 79, in receive_activity_internal
    return await callback(context)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 745, in on_turn
    await self._start_long_running_call(context, self._on_turn)
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 903, in _start_long_running_call
    return await func(context)
           ^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 751, in _on_turn
    self._remove_mentions(context)
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 786, in _remove_mentions
    context.activity.text = context.remove_recipient_mention(context.activity)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\turn_context.py", line 392, in remove_recipient_mention
    return TurnContext.remove_mention_text(activity, activity.recipient.id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\turn_context.py", line 401, in remove_mention_text
    escape(mention.additional_properties["text"]),
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'text'

Expected behavior

Give a clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@frankqianms frankqianms added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.
Projects
None yet
Development

No branches or pull requests

1 participant