Could not save event of type 'action' with timestamp

Hi,

On Rasa X, when I try to create intents using interactive mode I get an exception in the console .I get below error when I interact on the interactive learning tab to test the base model . Could not save event of type ‘action’ with timestamp. Please help on resolving this issue.

The detailed stack trace is WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type ‘action’ with timestamp '1584943030.4710948 for conversation ID ‘c2963f1fda6c4fbaaeb35445bfc5c774’ because it already exists. WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event due to unknown error: ‘This Session’s transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) UNIQUE constraint failed: conversation_event.conversation_id, conversation_event.timestamp, conversation_event.type_name [SQL: INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘c2963f1fda6c4fbaaeb35445bfc5c774’, ‘action’, 1584943030.4710948, None, ‘action_listen’, None, None, None, 0, ‘{“sender_id”: “c2963f1fda6c4fbaaeb35445bfc5c774”, “event”: “action”, “timestamp”: 1584943030.4710948, “name”: “action_listen”, “policy”: null, “confidence”: null}’, None, ‘production’)] (Background on this error at: http://sqlalche.me/e/gkpj) (Background on this error at: http://sqlalche.me/e/7s2a)’ WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event due to unknown error: ‘This Session’s transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) UNIQUE constraint failed: conversation_event.conversation_id, conversation_event.timestamp, conversation_event.type_name [SQL: INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘c2963f1fda6c4fbaaeb35445bfc5c774’, ‘action’, 1584943030.4710948, None, ‘action_listen’, None, None, None, 0, ‘{“sender_id”: “c2963f1fda6c4fbaaeb35445bfc5c774”, “event”: “action”, “timestamp”: 1584943030.4710948, “name”: “action_listen”, “policy”: null, “confidence”: null}’, None, ‘production’)] (Background on this error at: http://sqlalche.me/e/gkpj) (Background on this error at: http://sqlalche.me/e/7s2a)’

Thanks, Nivedita

Hi @niveditapdixit,

welcome to the community!
Can you please format your message and especially the code block?

Are there any error logs when starting Rasa X? How did you deploy Rasa X?

Hi @Tobias_Wochinger

I’m new in Rasa and I think I have the same problem.

The versions of the applications are: Python : 3.7.7 Rasa : 1.9.5 Rasa sdk : 1.9.0 Rasa-x : 0.27.4 I am working Rasa-X Local mode on Windows 10.

My bot works normally on rasa shell, apart from the fact that while running the “rasa run actions” command in another terminal showed the following, without displaying the message “Action endpoint is up and running, on (‘0.0.0.0’, ‘5055’)”: image

According to the forum’s answer to my question, this is not considered a problem : Problem with custon action server

About rasa x:

In the 1st terminal I run the command “rasa run actions - actions actions -vv” and the above image appears.

In the 2nd terminal I run the command “rasa x” and initially the messages below appear:

“Starting Rasa X in local mode… :rocket:

c:\venv-x\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent ‘greet’ on line 2. Please, make sure that all intents are listed in your domain yaml. docs=DOCS_URL_DOMAINS,

c:\venv-x\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent ‘affirm’ on line 7. Please, make sure that all intents are listed in your domain yaml. docs=DOCS_URL_DOMAINS,

c:\venv-x\lib\site-packages\rasa\core\training\dsl.py:422: UserWarning: Found unknown intent ‘deny’ on line 7. Please, make sure that all intents are listed in your domain yaml. docs=DOCS_URL_DOMAINS,”

…. Displays the same for all intents…

“The server is running at http://localhost:5002/login?username=me&password=lq7q6MCrNdOF

2020-04-04 20:21:52 WARNING sanic.root - Sanic tried to use loop.add_signal_handler but it is not implemented on this platform.

2020-04-04 20:21:52 WARNING sanic.root - Sanic tried to use loop.add_signal_handler but it is not implemented on this platform."

At this point the bot is uploading to the browser (chrome), while the message appears in the 2nd terminal (rasa x) :

“WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type ‘action’ with timestamp '1586021042.3033462 for conversation ID ‘5037013a75f54c2da7704a445ebaf2bf’ because it already exists.¨ “

Then, in each user input or response in the bot, the messages of this type appear in the 2nd terminal:

“WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event due to unknown error: 'This Session’s transaction has been rolled back due to a previous exception during flush.

To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) UNIQUE constraint failed: conversation_event.conversation_id, conversation_event.timestamp, conversation_event.type_name

[SQL: INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘5037013a75f54c2da7704a445ebaf2bf’, ‘action’, 1586021042.3033462, None, ‘action_listen’, None, None, None, 0, ‘{“sender_id”: “5037013a75f54c2da7704a445ebaf2bf”, “event”: “action”, “timestamp”: 1586021042.3033462, “name”: “action_listen”, “policy”: null, “confidence”: null}’, None, ‘production’)] (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation) (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)’ ”

During the operation of the bot in the browser, not all responses appear.

For example, in the 1st screenshot the “utter_question_continue” does not appear and in 2nd screenshot the “utter_crdetails” does not appear.

Please help me on resolving these issues.

Thanks.

1 Like

:thinking:Did you have a previous version of Rasa X installed? I suggest trying to start with a clean setup:

  • Move / delete all finds ending with db, db-shm or db-wal
  • Move / delete the models directory and train a new model from scratch

Hi

I created a new virtual environment and I installed the rasa x.

Error messages appear:

ERROR: mysql-connector-python 8.0.19 has requirement protobuf==3.6.1, but you’ll have protobuf 3.11.3 which is incompatible.

ERROR: rasa 1.9.5 has requirement prompt-toolkit<3.0,>=2.0, but you’ll have prompt-toolkit 3.0.5 which is incompatible.

For the 2nd error message I replaced the prompt-toolkit with the command : pip install prompt-toolkit==2.0.10

I couldn’t handle the first message.

I deleted all finds ending with db , db-shm or db-wal and previous models from my bot.

After that I face the same issue.

still the issue

Hello @Tobias_Wochinger @hello-code @niveditapdixit @PantelisAntoniadis

I have exactly the same issue as described by @PantelisAntoniadis.

I was using rasa x and rasa shell in previous version as 0.23.1 and 1.4.5 respectively. recently i upgraded my rasa on global and i started facing these issues.

Then i followed the steps of installing rasa in a virtual env using this YouTube link.

Rasa shell worked perfectly fine but when i tried using rasa x it said rasa x module not found. so i installed rasa x using

pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple

then rasa x started but i had the same issues afterwards i had the same issue as @PantelisAntoniadis.

As per your solution @Tobias_Wochinger to remove db , db-shm or db-wal files.

I figured that whenever i run rasa x command it is automatically created db , db-shm or db-wal files in the virtual environment.

Microsoft Visual C++ is already installed.

Help us deal with it.

Hello @PantelisAntoniadis @hello-code @Tobias_Wochinger @niveditapdixit i still dont know why rasa 1.9.5 and rasa-x 0.27.4 are not working but here are the few steps that i did to revert to my previous versions i.e rasa 1.4.5 and rasa-x 0.23.1 which used to work fine.

I uninstalled rasa and rasa-x using pip :

pip uninstall rasa
pip uninstall rasa-x

after installing i installed a previous version of rasa using :

pip install rasa==1.4.5

then i went to Pypicloud and downloaded a version older i.e 0.23.1 i.e rasa-x-0.23.1.tar and saved it to my root directory of anaconda prompt when open (in windows it is C:\Windows\System32)

then i run following command :

pip install rasa-x-0.23.1.tar

and it install rasa -x 0.23.1 also in my system.

and everything returned to normal.

But the question why i didnt worked with rasa-x version 0.27.1 and how to remove file like db , db-shm or db-wal. Because the issue is of it. i reinstalled my ananconda env and also tried virtual env.

@Tobias_Wochinger please look into this issue for windows 10.

python = 3.7.7 pip = 20.2.2 rasa = latest 1.9.5 rasa x = latest 0.27.4

2 Likes

Hi @Tobias_Wochinger,

Tried below, getting the same error of Could not save event of type ‘action’ with timestamp ‘’ for conversation ID ‘’. Please help.

  • Move / delete all finds ending with db , db-shm or db-wal
  • Move / delete the models directory and train a new model from scratch

The exception trace is
WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type ‘action’ with timestamp '1586759347.1013398 for conversation ID ‘8bd333f852184aada1f56116ab429b59’ because it already exists. WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event due to unknown error: ‘This Session’s transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) UNIQUE constraint failed: conversation_event.conversation_id, conversation_event.timestamp, conversation_event.type_name [SQL: INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘8bd333f852184aada1f56116ab429b59’, ‘action’, 1586759347.1013398, None, ‘action_listen’, None, None, None, 0, ‘{“sender_id”: “8bd333f852184aada1f56116ab429b59”, “event”: “action”, “timestamp”: 1586759347.1013398, “name”: “action_listen”, “policy”: null, “confidence”: null}’, None, ‘production’)] (Background on this error at: http://sqlalche.me/e/gkpj) (Background on this error at: http://sqlalche.me/e/7s2a)’ WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event due to unknown error: ‘This Session’s transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) UNIQUE constraint failed: conversation_event.conversation_id, conversation_event.timestamp, conversation_event.type_name [SQL: INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘8bd333f852184aada1f56116ab429b59’, ‘action’, 1586759347.1013398, None, ‘action_listen’, None, None, None, 0, ‘{“sender_id”: “8bd333f852184aada1f56116ab429b59”, “event”: “action”, “timestamp”: 1586759347.1013398, “name”: “action_listen”, “policy”: null, “confidence”: null}’, None, ‘production’)] (Background on this error at: http://sqlalche.me/e/gkpj) (Background on this error at: http://sqlalche.me/e/7s2a)’

Thanks, Nivedita

I think its a issue still not solved:

mhm, this error seems weird. Any idea how there can be duplicate conversation events?

Hi Tobias,

I am also facing the same issue as @niveditapdixit. I am running rasa X in my local windows 10 machine. I updated rasa X to the latest version 0.27.6 but still facing the same issue. Is there a workaround for this?

Regards, Anand

hi @anandtest94,

welcome to the community! Do you see anything interesting in the logs? Did you use rasa export or any idea if there could have been duplicate conversation events?

@PantelisAntoniadis @anandtest94 @Tobias_Wochinger hello, I am also facing the same issue in Rasa X

image

please let me know how to solve this issue. Rasa = 1.9.5 rasa x=0.27.4

Thank you. Akhil

We are looking into it and trying to reproduce it. I’ll come back to you as soon as I have any updates.

I’m facing the same error.

Rasa 1.7.0
Rasa X 0.27.5

I’m running Rasa X with template chatbot (created by rasa init) on Windows 10 using docker-compose.

Sometimes Rasa X works fine for a few messages but then this happens:

db_1               | 2020-04-21 09:27:58.026 GMT [189] ERROR:  duplicate key value violates unique constraint "conversation_event_uq"
db_1               | 2020-04-21 09:27:58.026 GMT [189] DETAIL:  Key (conversation_id, "timestamp", type_name)=(65e558c3f64d4c6095d12f6fd3fc993b, 1587461277.78013, action) already exists.
db_1               | 2020-04-21 09:27:58.026 GMT [189] STATEMENT:  INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES ('65e558c3f64d4c6095d12f6fd3fc993b', 'action', 1587461277.7801347, NULL, 'action_session_start', NULL, NULL, NULL, false, '{"sender_id": "65e558c3f64d4c6095d12f6fd3fc993b", "event": "action", "timestamp": 1587461277.7801347, "name": "action_session_start", "policy": null, "confidence": null}', NULL, 'production') RETURNING conversation_event.id
rasa-x_1           | WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type 'action' with timestamp '1587461277.7801347 for conversation ID '65e558c3f64d4c6095d12f6fd3fc993b' because it already exists.
db_1               | 2020-04-21 09:27:58.035 GMT [189] ERROR:  duplicate key value violates unique constraint "conversation_event_uq"
db_1               | 2020-04-21 09:27:58.035 GMT [189] DETAIL:  Key (conversation_id, "timestamp", type_name)=(65e558c3f64d4c6095d12f6fd3fc993b, 1587461277.78014, session_started) already exists.
db_1               | 2020-04-21 09:27:58.035 GMT [189] STATEMENT:  INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES ('65e558c3f64d4c6095d12f6fd3fc993b', 'session_started', 1587461277.7801425, NULL, NULL, NULL, NULL, NULL, false, '{"sender_id": "65e558c3f64d4c6095d12f6fd3fc993b", "event": "session_started", "timestamp": 1587461277.7801425}', NULL, 'production') RETURNING conversation_event.id
rasa-x_1           | WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type 'session_started' with timestamp '1587461277.7801425 for conversation ID '65e558c3f64d4c6095d12f6fd3fc993b' because it already exists.
db_1               | 2020-04-21 09:27:58.048 GMT [189] ERROR:  duplicate key value violates unique constraint "conversation_event_uq"
db_1               | 2020-04-21 09:27:58.048 GMT [189] DETAIL:  Key (conversation_id, "timestamp", type_name)=(65e558c3f64d4c6095d12f6fd3fc993b, 1587461277.78016, action) already exists.
db_1               | 2020-04-21 09:27:58.048 GMT [189] STATEMENT:  INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES ('65e558c3f64d4c6095d12f6fd3fc993b', 'action', 1587461277.7801578, NULL, 'action_listen', NULL, NULL, NULL, false, '{"sender_id": "65e558c3f64d4c6095d12f6fd3fc993b", "event": "action", "timestamp": 1587461277.7801578, "name": "action_listen", "policy": null, "confidence": null}', NULL, 'production') RETURNING conversation_event.id
rasa-x_1           | WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type 'action' with timestamp '1587461277.7801578 for conversation ID '65e558c3f64d4c6095d12f6fd3fc993b' because it already exists.

@Tobias_Wochinger If it could help, I can post full project on github

Hi @Tobias_Wochinger,

I am getting all the errors mentioned by @PantelisAntoniadis in the initial question he has mentioned above along with the screnshots. I have not used rasa export. I don’t think there is any duplicate conversation event since it is working perfectly fine when I run it through rasa shell. I might be wrong since I am new to rasa.

Regards, Anand

Hi, I had the exact same issue today with Rasa = 1.9.5 and Rasa X = 0.27.4

I don’t know if any of this is related to the error, but I ran rasa x with --debug

Here a new tracker is created twice with the same ID

2020-04-22 18:10:43 DEBUG    rasa.core.tracker_store  - Creating a new tracker for id '3d10f50f02f64e7d861e8abf79a18569'.
2020-04-22 18:10:43 DEBUG    rasa.core.tracker_store  - Creating a new tracker for id '3d10f50f02f64e7d861e8abf79a18569'.

Further down, when the Rasa X is up and running it seems like it tries to save the same event several times:

DEBUG:rasax.community.services.event_service:Saving event from origin 'production' to event service:
{"sender_id": "3d10f50f02f64e7d861e8abf79a18569", "event": "action", "timestamp": 1587597065.4418805, "name": "action_listen", "policy": null, "confidence": null}
DEBUG:rasax.community.database.utils:Turned SQLite foreign key enforcement on.
DEBUG:rasax.community.database.utils:Turned on SQLite WAL mode.
DEBUG:rasax.community.services.event_service:An event with data {"sender_id": "3d10f50f02f64e7d861e8abf79a18569", "event": "action", "timestamp": 1587597065.4418805, "name": "action_listen", "policy": null, "confidence": null} is saved as pending.
WARNING:rasax.community.services.event_consumers.event_consumer:Could not save event of type 'action' with timestamp '1587597065.4418805 for conversation ID '3d10f50f02f64e7d861e8abf79a18569' because it already exists.

@KalleBylin Are you also running on Windows? @alwx is currently looking into the issue from our side.

@Tobias_Wochinger im running on windows 10


im also getting this and in the background in cmd:

[SQL: INSERT INTO conversation_event (conversation_id, type_name, timestamp, intent_name, action_name, slot_name, slot_value, policy, is_flagged, data, evaluation, rasa_environment) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] [parameters: (‘1eb0ade78cdd410191f87549d6d5e321’, ‘action’, 1587972533.1968193, None, ‘action_listen’, None, None, None, 0, ‘{“sender_id”: “1eb0ade78cdd410191f87549d6d5e321”, “event”: “action”, “timestamp”: 1587972533.1968193, “name”: “action_listen”, “policy”: null, “confidence”: null}’, None, ‘production’)] (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation) (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)’

Versions: rasa 1.9.6 rasa-sdk 1.9.0 rasa-x 0.27.4