Applies to: Mattermost Server with the Playbooks plugin, on PostgreSQL databases migrated from MySQL using pgloader / the Migration Assist tool
Symptoms: A Playbooks channel action configured to add the run channel to a sidebar category has no effect, and the run channel stays in the default "Channels" list.
🛑 Problem
When a Playbooks run starts, the "When a user joins the channel" action should move the run channel into a configured sidebar category. On databases migrated from MySQL to PostgreSQL, this action can silently fail because two Playbooks columns hold JSON data but are stored as PostgreSQL text instead of json:
ir_channelaction.payloadir_userinfo.digestnotificationsettingsjson
Playbooks reads these columns as JSON, so a text column causes the read to fail and the action to be skipped. The plugin configuration is correct; the problem is purely at the database layer. It occurs because pgloader leaves these two columns as text unless they are explicitly cast during migration. Most other columns convert correctly, so only this feature is affected.
Symptoms
Administrators will see the following in the Playbooks debug logs when a user joins a run channel:
failed to get the channel actions sql: Scan error on column index 6, name "payload": unsupported Scan, storing driver.Value type string into type *json.RawMessage
Additional symptoms:
- A channel action with "Add the channel to a sidebar category for the user" enabled has no effect; the channel appears in the default "Channels" category.
- HTTP 500 responses on the Playbooks
/plugins/playbooks/api/v0/bot/connectrequest, caused by the same mismatch onir_userinfo.digestnotificationsettingsjson. - The database was previously migrated from MySQL to PostgreSQL.
âś… Solution
Convert the two columns from text to json. The stored data is already valid JSON written by the plugin, so the conversion is safe. Upgrading or rolling back the server or plugin does not fix this, because the column type is set in the database and is not changed by a version change.
Back up the database
Take a full backup of the PostgreSQL database before making schema changes.
Convert the two columns to JSON
Run the following against your Mattermost PostgreSQL database:
ALTER TABLE ir_channelaction ALTER COLUMN payload TYPE json USING payload::json; ALTER TABLE ir_userinfo ALTER COLUMN digestnotificationsettingsjson TYPE json USING digestnotificationsettingsjson::json;
⚠️ Important: No configuration change or server restart is required. The next time a user joins a run channel the action fires correctly. Reconnect the client to clear the bot-connection error.
Audit for other affected columns
Check whether any other migrated Playbooks columns were left as text:
SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_name LIKE 'ir\_%' AND (column_name LIKE '%json%' OR column_name = 'payload');
Convert any additional JSON columns reported as text using the same ALTER TABLE ... TYPE json USING ...::json pattern.
Additional Resources
For more information, see:
https://support.mattermost.com/hc/en-us/articles/46908485242260
Comments
Article is closed for comments.