Skip to content

Instantly share code, notes, and snippets.

@agnivade
Created January 3, 2022 14:31
Show Gist options
  • Save agnivade/26a73054303b3874055eadd52c3e50d7 to your computer and use it in GitHub Desktop.
Save agnivade/26a73054303b3874055eadd52c3e50d7 to your computer and use it in GitHub Desktop.
Invalid json

While trying to upgrade to an MM version >= 6.0.x, you might encounter an error of the form:

Failed to alter column type. It is likely you have invalid JSON values in the column. Please fix the values manually and run the migration again.

This means the particular column has some invalid JSON values which need to be fixed manually. A common fix that has known to work is to wipe out all \u0000 characters.

Follow these steps:

  1. Check the affected values by: SELECT COUNT(*) FROM <table> WHERE <column> LIKE '%\u0000%';
  2. If you get a count more than 0, check those values manually, and confirm they are okay to be removed.
  3. Remove them by UPDATE <table> SET <column> = regexp_replace(<column>, '\\u0000', '', 'g') where <column> like '%\u0000%';

Then try to start Mattermost again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment