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
Open
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.