Skip to content

Exception when inserting Event into DB when error_message is longer than 1024 characters #2821

@zdenulo

Description

@zdenulo

We are using CloudSQL (PostgreSQL) as our database for sessions. Sometimes, when an error in an agent occurs (usually a MALFORMED FUNCTION and input containing JSON data), it causes an exception when inserting data into the DB.

This is the error
sqlalchemy.exc.ProgrammingError: (pg8000.dbapi.ProgrammingError) {'S': 'ERROR', 'V': 'ERROR', 'C': '22001', 'M': 'value too long for type character varying(1024)', 'F': 'varchar.c', 'L': '640', 'R': 'varchar'}

The issue is with the 'Events' table and the column/field 'error_message', which has a length of 1024.

error_message: Mapped[str] = mapped_column(String(1024), nullable=True)

The fix in the code (for initial table creation) would be to change the type of the error_message column to Text type.
For existing tables, this would also mean changing the column type on the database level.

I don't know if there would be other implications of this change.

Metadata

Metadata

Labels

services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions