question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DialogContextError in botbuilder-dialogs

See original GitHub issue

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

Versions

package version of the SDK: ^4.7.0 node.js version: v12.13.1 browser version: Chrome 87 os: Windows 10 bot written in Typescript 3.9.7

Describe the bug

The user is stuck in a weird dialog state and cannot interact with the bot anymore, receiving only the “Sorry, it looks like something went wrong.” error message. The implemented interruption logic (CancelDialog) is not working either. User’s last successful conversation with the bot ended the current dialog, so the user is not stuck in a previous conversation.

Here are some useful stack traces from the logs:

DialogContextError_MainDialog

DialogContextError_DialogContext

And the actual stringified error here:

DialogContextError

Analyzing the stack trace, here’s the error that’s being thrown in the /botbuilder-dialogs/lib/dialogContext.js:

throw new dialogContextError_1.DialogContextError(DialogContext.continueDialog(): Can’t continue dialog. A dialog with an id of ‘${instance.id}’ wasn’t found., this);

Here is the code for the dialogBot.ts where the error is being thrown (in turn method) and mainDialog.ts where a dialog is started based on the detected skill of the bot.

https://github.com/StefaniaMan314/botbuilder

To Reproduce

Every time the user tries to start a new conversation with the bot a DialogContextError is being thrown and the dialog cannot be started.

Expected behavior

The dialog to start is found in the dialog context or in its parent dialog context.

Screenshots

Here’s a screenshot of the user’s conversations and the bot’s responses:

teams_chatbot_conversation

Additional context

The odd thing is that this is happening only for a few users (3) across the org (from a total of ~5000 users). This is an unprecedented issue.

Here are several ways we tried to solve this, but none of them worked:

  • Clearing state DB entries for this user
  • Uninstalling and installing back the bot in Teams
  • Clearing Teams cache on the user’s machine

Any help is greatly appreciated. Thank you!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
StefaniaMan314commented, Feb 2, 2021

We found a way to clear the conversationId in our botstate db. The issue was solved for the users, we can close this, thanks!

1reaction
StefaniaMan314commented, Jan 27, 2021

onEvent is triggered when the user performs an action submitted from an AC (for example clicking a button). The main thing that’s happening here is that dc.continueDialog() is being called, and if the status of the dialog turn result is complete, it calls the complete() method that clears the skill status.

You can ignore the TokenResponseEventName check, as I debugged the code and it never passes this condition . It must be a reminiscent code from an older version of the project.

I will add more logs across the project to identify bot state elements such as the conversationId that could help me track the user’s interaction in our state database and understand what’s happening. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

botbuilder-dialogs package - Microsoft Learn
A container for a set of Dialogs. DialogContext. The context for the current dialog turn with respect to a specific DialogSet. DialogContextError.
Read more >
Bot Framework SDK 4.11 DialogContextError: Cannot read ...
I am facing an error after updating Microsoft botbuilder and botbuilder-dialog version 4.11.0. It's working fine with the earlier versions.
Read more >
Microsoft/BotBuilder - Gitter
DialogContextError. Analyzing the stack trace, here's the error that's being thrown in the /botbuilder-dialogs/lib/dialogContext.js:.
Read more >
Microsoft Bot Framework helpers and additional dialogs
This project is intended to become a selection of additional dialogs, ... ComponentDialog, WaterfallDialog } = require('botbuilder-dialogs'); const ...
Read more >
Page 3838 of 32684 - Online Tools and Answers for ... - Code Utility
node.js – Oauth bot framework – DialogContextError: context.adapter. ... dialog very similar to: https://github.com/microsoft/BotBuilder-Samples/tree/main/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found