Error while executing Action file for the 1st time


I tried to create a basic bot using Rasa. With the help of Rasa Community members I was able to do it. But Bot is throwing error only when it executes Action file for the 1st time. But all subsequent conversations work fine.

Conversation flow:

  • Usual Greet
  • User Enters Crop and Disease
  • Bot pulls the remedy from sqlite (thru action) and utter it as message
  • If user enters only disease name, then Bot asks for crop and then pulls the info
  • If user enters only crop name, then Bot asks for disease and then pulls the info

What happens is, I get an error when the Bot executes action file for the first time.

Action Log

From the action log, it looks like it is trying to pull the data from sqlite even though it got only disease name from user (crop is still None). But as per Actions file coding, that is not supposed to happen.

The part where sqlite is queried should occur only when both crop and disease is not None. This logic is working fine in subsequent instances. But getting error when I start the conversation for first time. Please advise.

1 Like

@rsklearner Hello, are you using some python file or class?

Please remove the . infront of from pull_remedy import remedysql OR share the related files if this not work. OR if its relative path then fine :slight_smile:

@rsklearner Further, two more issue in the file on line 8 please check the syntax of remedy = mycursor.execute(sql) or what is the code for mycursor.

check the line 79 disease_name is this a column or attribute exist in the database? I really dont know your database schema, so just guessing. Sorry!

By taking your code there as reference, please put print(sql, remedy) before the return to debug a bit and check if all works as expected or not.

Also I think fetchone() will fetch a new row each time, not sure how much it affects the process here - This is more SQL than Rasa. Try using fetchall() instead. You’re doing [0] later anyway.

@ChrisRahme So, its related post thanks Chris! But, I mentioned the error :slight_smile: what ever I understand.

1 Like

Oh! I haven’t noticed the 2nd part, sorry :joy: Did you edit it while I was writing my answer or am I too tired? :joy:

Anyway it’s not the exact same reply so it should be fine :slight_smile:

@ChrisRahme No, may be our processor is slow now :stuck_out_tongue: I am dead now :wink:

1 Like


pull_remedy code

I get the values for “Crop” and “Disease” from User. So as per previous screenshot, the user inputs “wilt” (disease name alone) and at this point there is no value for slot - “Crop” i.e., None. But the control still goes to the logic in Actions file, where we hit the sql db [only when both disease and crop are not None].

This error is occurring only the 1st time when I give only the disease or crop and not both. But this error is not occurring in subsequent conversations. All future conversations work fine even if I give only disease name or crop name or combination of both.