sqlalchemy.exc.DataError: (psycopg2.errors.StringDataRightTruncation) value too long for type character

Hello,

after updating rasa from 1.1.5 to 1.2.9 and RasaX from 0.19.5 to 0.20.3, I receive an error in Rasa X that is triggered by an SQL command issued to the postgresql db, potentially rasax/community/database/schema_migrations/alembic/env.py", line 76, in run_migrations_online if I am not mistaken (full error below).

I also updated the versions of the other containers:

postgres: 11.2.0, nginx: 0.20.3, rabbit: 3.7.17

Has anyone else experienced this?

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.StringDataRightTruncation: value too long for type character varying(255)


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

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/site-packages/rasax/community/server.py", line 85, in <module>
    main()
  File "/usr/local/lib/python3.6/site-packages/rasax/community/server.py", line 27, in main
    sql_migrations.run_migrations(session)
  File "/usr/local/lib/python3.6/site-packages/rasax/community/sql_migrations.py", line 25, in run_migrations
    _run_schema_migrations(session)
  File "/usr/local/lib/python3.6/site-packages/rasax/community/sql_migrations.py", line 46, in _run_schema_migrations
    command.upgrade(alembic_config, "head")
  File "/usr/local/lib/python3.6/site-packages/alembic/command.py", line 276, in upgrade
    script.run_env()
  File "/usr/local/lib/python3.6/site-packages/alembic/script/base.py", line 475, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 90, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python3.6/site-packages/alembic/util/compat.py", line 156, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/env.py", line 85, in <module>
    run_migrations_online()
  File "/usr/local/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/env.py", line 76, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/environment.py", line 839, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", line 361, in run_migrations
    step.migration_fn(**kw)
  File "/usr/local/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/versions/migration_2019_08_26_oracle_migrations_4daabca814ee.py", line 207, in upgrade
    existing_type=sa.String(),
  File "/usr/local/lib/python3.6/contextlib.py", line 88, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/base.py", line 325, in batch_alter_table
    impl.flush()
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/batch.py", line 73, in flush
    fn(*arg, **kw)
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/postgresql.py", line 126, in alter_column
    existing_nullable=existing_nullable,
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/impl.py", line 134, in _exec
    return conn.execute(construct, *multiparams, **params)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 988, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1050, in _execute_ddl
    compiled,
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 128, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.DataError: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(255)

[SQL: ALTER TABLE template ALTER COLUMN text TYPE VARCHAR(255) ]
(Background on this error at: http://sqlalche.me/e/9h9h)

Yes, there was a bug where templates were restricted to 255 chars, which I believe the fix made it into the latest rasa X release. You could try upgrading directly to 0.21 and the latest stable rasa, and see if that works?

Thanks, that solved it!

Awesome :rocket: