Skip to content

fix: change agent_custom_config column type to TEXT to prevent Data too long error#66

Open
octo-patch wants to merge 1 commit into53AI:mainfrom
octo-patch:fix/issue-52-agent-custom-config-field-length
Open

fix: change agent_custom_config column type to TEXT to prevent Data too long error#66
octo-patch wants to merge 1 commit into53AI:mainfrom
octo-patch:fix/issue-52-agent-custom-config-field-length

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #52
Fixes #57

Problem

The agent_custom_config column in the messages table was created without an explicit type annotation in its GORM struct tag. This caused GORM to use a short VARCHAR type (reported as VARCHAR(16) or VARCHAR(255) depending on setup), insufficient for storing longer agent configuration content.

Users encountered: Error 1406 (22001): Data too long for column 'agent_custom_config' at row 1

Solution

Added type:text to the GORM tag for AgentCustomConfig in api/model/message.go, consistent with how Message, Answer, and ReasoningContent are defined in the same struct.

Before: AgentCustomConfig string with gorm:"default:''"
After: AgentCustomConfig string with gorm:"default:'';type:text"

When MIGRATE_DB_ENABLED=true, AutoMigrate will update the column type in existing databases.

Testing

Verified the fix is minimal and consistent with other long-text fields in the struct.

…oo long error (fixes 53AI#52)

The agent_custom_config column was created without an explicit type annotation,
causing GORM to default to a short VARCHAR type. This resulted in
'Error 1406: Data too long for column agent_custom_config' when users configured
agents with long custom config content.

Changed the GORM tag to use type:text, consistent with the Message, Answer, and
ReasoningContent fields in the same struct. AutoMigrate will update the column
type in existing databases when MIGRATE_DB_ENABLED=true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant