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

Still getting error: 'turn' does not match memory scopes:[] (Parameter 'key') #3361

Closed
marcscheuner-bfh opened this issue Jul 5, 2021 · 9 comments
Assignees
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository. needs-triage The issue has just been created and it has not been reviewed by the team.

Comments

@marcscheuner-bfh
Copy link

marcscheuner-bfh commented Jul 5, 2021

Sample information

Sample type: \samples
Sample language: dotnetcore
Sample name: 49.qnamaker-all-features

Describe the bug
If update to BotBuilder 4.14.0, active learning does not work anymore

To Reproduce
update bot builder packages to 4.14.0
trigger qna active learning
bot get exception

'turn' does not match memory scopes:[] (Parameter 'key')

According to previous bug #3194, this should have been fixed - but I cannot concur - I still get that very same error with Bot Framework v4.14

@marcscheuner-bfh marcscheuner-bfh 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 Jul 5, 2021
@dmvtech dmvtech added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-reported Issue is created by anyone that is not a collaborator in the repository. labels Jul 5, 2021
@anusharr
Copy link
Contributor

anusharr commented Jul 7, 2021

@marcscheuner-bfh, I am able to get active learning to work after updating the packages to 4.14.0.
image

Can you attach a screenshot of the exception you are getting and also what channel are you testing the bot on? Also, did active learning work as expected before updating to 4.14.0?

@anusharr anusharr added the customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. label Jul 7, 2021
@marcscheuner-bfh
Copy link
Author

Here's the screenshot - I'm testing my bot in the Bot Emulator, as well as in MS Teams - error happens in both places:

image

The conversation is in German, but the point is: I'm asking a question "MWST" which isn't specific enough, and the bot responds with "Did you mean?" and shows options - and after that, I get the error.....

I believe Active Learning did work before - and still does (at least the CallTrainAsync waterfall dialog step / method is being called on the QnAMakerDialog class). Commenting out that step also doesn't change the behavior of the code.

@anusharr
Copy link
Contributor

@marcscheuner-bfh, do you get any additional error on Visual Studio? Also, can you try debugging using ngrok by setting breakpoints in Visual Studio?

@marcscheuner-bfh
Copy link
Author

The error happens in (Microsoft-generated) public class QnAMakerDialog : WaterfallDialog, in method OnPreBubbleEventAsync on line 456:

dc.State.SetValue($"turn.qnaresult{this.GetHashCode()}", response);

And this is the full exception message I get:

Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Error: [OnTurnError] unhandled error : 'turn' does not match memory scopes:[] (Parameter 'key')

System.ArgumentOutOfRangeException: 'turn' does not match memory scopes:[] (Parameter 'key')
at Microsoft.Bot.Builder.Dialogs.Memory.DialogStateManager.set_Item(String key, Object value)
at Microsoft.Bot.Builder.Dialogs.ObjectPath.SetObjectSegment(Object obj, Object segment, Object value, Boolean json)
at Microsoft.Bot.Builder.Dialogs.ObjectPath.SetPathValue(Object obj, String path, Object value, Boolean json)
at Microsoft.Bot.Builder.Dialogs.Memory.DialogStateManager.SetValue(String path, Object value)
at Microsoft.Bot.Builder.AI.QnA.Dialogs.QnAMakerDialog.OnPreBubbleEventAsync(DialogContext dc, DialogEvent e, CancellationToken cancellationToken) in D:\projects\bfh\Services-Infobot\sdk\Microsoft.Bot.Builder.AI.QnA\Dialogs\QnAMakerDialog.cs:line 456
at Microsoft.Bot.Builder.Dialogs.Dialog.OnDialogEventAsync(DialogContext dc, DialogEvent e, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Dialogs.DialogContext.EmitEventAsync(String name, Object value, Boolean bubble, Boolean fromLeaf, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Dialogs.DialogExtensions.InternalRunAsync(ITurnContext turnContext, String dialogId, DialogContext dialogContext, DialogStateManagerConfiguration stateConfiguration, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.Dialogs.DialogExtensions.RunAsync(Dialog dialog, ITurnContext turnContext, IStatePropertyAccessor1 accessor, CancellationToken cancellationToken) at Bfh.Services.Infobot.Bots.QnABot1.OnMessageActivityAsync(ITurnContext1 turnContext, CancellationToken cancellationToken) in D:\projects\bfh\Services-Infobot\bot\Bots\QnABot.cs:line 114 at Microsoft.Bot.Builder.ActivityHandler.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) at Bfh.Services.Infobot.Bots.QnABot1.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) in D:\projects\bfh\Services-Infobot\bot\Bots\QnABot.cs:line 45
at Microsoft.Bot.Builder.BotFrameworkAdapter.TenantIdWorkaroundForTeamsMiddleware.OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.16\Microsoft.Win32.Registry.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Information: Sending activity. ReplyToId: a470ebc0-e89f-11eb-80dc-a39de999f030
Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Information: GetTokenAsync: Acquired token using ADAL in 0.
Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Information: Sending activity. ReplyToId: a470ebc0-e89f-11eb-80dc-a39de999f030
Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Information: GetTokenAsync: Acquired token using ADAL in 0.
Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Information: Sending activity. ReplyToId: a470ebc0-e89f-11eb-80dc-a39de999f030
Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter: Information: GetTokenAsync: Acquired token using ADAL in 0.
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action Bfh.Services.Infobot.Controllers.BotController.PostAsync (Bfh.Services.Infobot) in 21404.6102ms
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'Bfh.Services.Infobot.Controllers.BotController.PostAsync (Bfh.Services.Infobot)'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 21414.7844ms 200

@marcscheuner-bfh
Copy link
Author

Downgrading the Bot Framework to v4.12.3 fixed the issue - in this version, I do NOT get this error - in any newer version, the error appears.

@LeeParrishMSFT
Copy link
Contributor

@marcscheuner-bfh Can you check to see if the sample code you have includes the fix that was made here: #3347 as this was supposed to correct the issue until a fix can be made in the SDK. Based on what I'm seeing the SDK has not yet been corrected for this issue, so the workaround is in #3374.

@marcscheuner-bfh
Copy link
Author

@LeeParrishMSFT sorry - I'm not using the samples - I'm using the code that got generated after creating and publishing a QnAMaker knowledge base. I have taken that as a starting point and have been adding features and capabilities to it.

Not sure if I'd find those fixes you mention in that code base as well ....

@sahithikkss-zz
Copy link
Contributor

@marcscheuner-bfh

@LeeParrishMSFT sorry - I'm not using the samples - I'm using the code that got generated after creating and publishing a QnAMaker knowledge base. I have taken that as a starting point and have been adding features and capabilities to it.

Not sure if I'd find those fixes you mention in that code base as well ....

Yes, please add code changes mentioned in #3347 along with upgrading the package to 4.14.1 version
image

@marcscheuner-bfh
Copy link
Author

@LeeParrishMSFT @sahithikkss OK thanks for the hint - with this extra line in startup.cs, I was able to upgrade to v4.14.1 and my code base works without this error - thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository. 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

5 participants