Unable to start Mattermost boards plugin

Hi,

I just wanted to share this fix as it might be overlooked and took me a few hours to get it fixed, but as usual was something simple

I’m using Mattermost on a bitnami server

I have updated from Mattermost 5.37 to version 6.0 and I am unable to start the Boards plugin. I have not used this before hand and wanted to have a look.

When I looked at the plugin management section it show as “This plugin failed to start. Check your system logs for errors”

image

I’ve had a look at the debug logs an can see the following is produced when the plugin is trying to start


{"timestamp":"2021-10-15 12:20:19.371 Z","level":"info","msg":"debug [2021-10-15 12:20:19.369 Z] importInitialTemplates caller=\"mlog/mlog.go:213\"\ndebug [2021-10-15 12:20:19.371 Z] Inserting blocks caller=\"mlog/mlog.go:213\" block_count=36\n","caller":"io/io.go:425","plugin_id":"focalboard","source":"plugin_stdout"}
{"timestamp":"2021-10-15 12:20:19.377 Z","level":"info","msg":"error [2021-10-15 12:20:19.377 Z] InitializeTemplates failed caller=\"mlog/mlog.go:228\" error=\"Error 1366: Incorrect string value: '\\xF0\\x9F\\x99\\x8C\"}...' for column 'fields' at row 1\"\n","caller":"io/io.go:425","plugin_id":"focalboard","source":"plugin_stdout"}
{"timestamp":"2021-10-15 12:20:19.380 Z","level":"warn","msg":"error closing client during Kill","caller":"plugin/hclog_adapter.go:70","plugin_id":"focalboard","wrapped_extras":"errunexpected EOF"}
{"timestamp":"2021-10-15 12:20:19.380 Z","level":"warn","msg":"plugin failed to exit gracefully","caller":"plugin/hclog_adapter.go:72","plugin_id":"focalboard"}
{"timestamp":"2021-10-15 12:20:19.380 Z","level":"error","msg":"Unable to activate plugin","caller":"app/plugin.go:146","plugin_id":"focalboard","error":"error initializing the DB: Error 1366: Incorrect string value: '\\xF0\\x9F\\x99\\x8C\"}...' for column 'fields' at row 1"}

{"timestamp":"2021-10-15 12:20:19.510 Z","level":"info","msg":"debug [2021-10-15 12:20:19.509 Z] importInitialTemplates caller=\"mlog/mlog.go:213\"\ndebug [2021-10-15 12:20:19.510 Z] Inserting blocks caller=\"mlog/mlog.go:213\" block_count=36\n","caller":"io/io.go:425","plugin_id":"focalboard","source":"plugin_stdout"}
{"timestamp":"2021-10-15 12:20:19.517 Z","level":"info","msg":"error [2021-10-15 12:20:19.517 Z] InitializeTemplates failed caller=\"mlog/mlog.go:228\" error=\"Error 1366: Incorrect string value: '\\xF0\\x9F\\x99\\x8C\"}...' for column 'fields' at row 1\"\n","caller":"io/io.go:425","plugin_id":"focalboard","source":"plugin_stdout"}
{"timestamp":"2021-10-15 12:20:19.518 Z","level":"error","msg":"Unable to activate plugin","caller":"app/plugin.go:146","plugin_id":"focalboard","error":"error initializing the DB: Error 1366: Incorrect string value: '\\xF0\\x9F\\x99\\x8C\"}...' for column 'fields' at row 1"}

After doing a bit of googling it and getting stuck down a rabbit hole of configuring MySQL to use utf8mb4 Character set for all the focalboard_blocks* tables,

Used this to check

SELECT TABLE_NAME,CCSA.character_set_name FROM information_schema.`TABLES` T,
       information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
  AND T.table_name LIKE "focalboard_blocks%";

Of course that was correct anyway, and I am using Mysql version 8 so utf8mb4 is also supported.

After getting no where fast and just about to install another database such as MariaDB to test if that worked out.

I stumbled on the SqlSettings in the config.json file and noticed the issue instantly
So the DataSource was set to the following

"DataSource": "USERNAME:PASSWORD@tcp(127.0.0.1:3306)/bitnami_mattermost?charset=utf8",

The charset is only set to use utf8, which only allows the 3 byte characters and not the 4 byte characters that utf8mb4 supports.

So the fix is to add it to the charset in the DataSource

"DataSource": "USERNAME:PASSWORD@tcp(127.0.0.1:3306)/bitnami_mattermost?charset=utf8mb4,utf8",

I hope this helps someone…

cc @mgdelacroix @chenilim

tl;dr -

If you see the error above, Check your SqlSetting section in the config.json file for DataSource and make sure the charset has utf8mb4 included

Change

"DataSource": "USERNAME:PASSWORD@tcp(127.0.0.1:3306)/bitnami_mattermost?charset=utf8",

For

"DataSource": "USERNAME:PASSWORD@tcp(127.0.0.1:3306)/bitnami_mattermost?charset=utf8mb4,utf8",

1 Like