How to resolve OperationalError: (sqlite3.OperationalError) attempt to write a readonly database

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) attempt to write a readonly database

[SQL: INSERT INTO events (sender_id, type_name, timestamp, intent_name, action_name, data) VALUES (?, ?, ?, ?, ?, ?)]

[parameters: (‘user’, ‘user’, 1567054384.3168602, ‘greet’, None, ‘{“event”: “user”, “timestamp”: 1567054384.3168602, “text”: “hi”, “parse_data”: {“intent”: {“name”: “greet”, “confidence”: 0.8857800960540771}, “entit … (559 characters truncated) … ion2”, “confidence”: 0.070087730884552}], “text”: “hi”}, “input_channel”: “rest”, “message_id”: “4374b9777acd45e7b3087fb71bb1a6bf”, “metadata”: null}’)]

(Background on this error at: http://sqlalche.me/e/e3q8)

@galandeshridhar I believe we talked about - maybe someone in the community can help you though. Could you give some more information, like which platform you’re running on and what permissions the file has?

I am using windows IIS feature for server. When I run the model on server that time getting above error otherwise my model is working.

File permission details: -rw-r–r-- 1 GLLB5989 1049089 86016 Aug 29 12:53 rasa.db

rasa verion: 1.2.5

same issue.

I executed peacefully ‘rasa x’ .

I got the error “sqlite3.OperationalError: attempt to write a readonly database” after a refactoring of the code

Any idea how to overcome the issue?

chatbot\rasa>rasa x
2019-11-25 08:25:05.776142: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
Starting Rasa X in local mode... 🚀
Traceback (most recent call last):
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: attempt to write a readonly database

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\rasa\cli\x.py", line 384, in run_locally
    local.main(args, project_path, args.data, token=rasa_x_token)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\rasax\community\local.py", line 190, in main
    initialise.create_community_user(session, app)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\rasax\community\initialise.py", line 181, in create_community_user
    COMMUNITY_USERNAME, password, COMMUNITY_TEAM_NAME
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\rasax\community\services\user_service.py", line 164, in insert_or_update_user
    if self.fetch_user(username):
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\rasax\community\services\user_service.py", line 63, in fetch_user
    user = self._fetch_user(username)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\rasax\community\services\user_service.py", line 70, in _fetch_user
    return self.query(User).filter(User.username == username).first()
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\query.py", line 3232, in first
    ret = list(self[0:1])
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\query.py", line 3018, in __getitem__
    return list(res)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\query.py", line 3333, in __iter__
    self.session._autoflush()
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\session.py", line 1588, in _autoflush
    util.raise_from_cause(e)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\util\compat.py", line 398, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\util\compat.py", line 153, in reraise
    raise value
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\session.py", line 1577, in _autoflush
    self.flush()
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\session.py", line 2459, in flush
    self._flush(objects)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\session.py", line 2597, in _flush
    transaction.rollback(_capture_exception=True)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\util\langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\util\compat.py", line 153, in reraise
    raise value
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\session.py", line 2557, in _flush
    flush_context.execute()
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 422, in execute
    rec.execute(self)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 589, in execute
    uow,
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\persistence.py", line 236, in save_obj
    update,
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\orm\persistence.py", line 996, in _emit_update_statements
    statement, multiparams
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute
    return meth(self, multiparams, params)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\sql\elements.py", line 287, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\base.py", line 1107, in _execute_clauseelement
    distilled_params,
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\base.py", line 1248, in _execute_context
    e, statement, parameters, cursor, context
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\base.py", line 1466, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\util\compat.py", line 398, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\util\compat.py", line 152, in reraise
    raise value.with_traceback(tb)
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "c:\app\miniconda2\envs\my_env\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(sqlite3.OperationalError) attempt to write a readonly database
[SQL: UPDATE password SET password=? WHERE password.password = ?]
[parameters: ('wc84mGnS4NO1', 'e1PoGgg67ubI')]
(Background on this error at: http://sqlalche.me/e/e3q8)

Sorry, something went wrong (see error above). Make sure to start Rasa X with valid data and valid domain and config files. Please, also check any warnings that popped up.
If you need help fixing the issue visit our forum: https://forum.rasa.com/.

ISSUE : the file attribute of rasa.db is set to ‘read only’

SOLUTION : removing the ‘read only’ attribute

ISSUE STILL OPEN : new error occurs : rasa.core.tracker_store - Error happened when trying to save conversation tracker to ‘InMemoryTrackerStore’. Falling back to use the ‘InMemoryTrackerStore’. Please investigate the following error: (sqlite3.OperationalError) attempt to write a readonly database