The discussion revolves around an issue with a Discourse instance failing to restore or update due to a PG::InvalidTextRepresentation error. The error occurs during the db:migrate command and is caused by an invalid value in the selectable_avatars site setting.
The OP, Spitap, provides the error logs, and pfaffman suspects a bug in the core code. Spitap confirms that the instance is vanilla, with no custom plugins.
JammmyDodger suggests using the Rails console to investigate the issue and provides a command to run. Spitap runs the command and shares the output, which shows an empty array value in the selectable_avatars setting.
JammmyDodger advises setting the value to an empty string, and Spitap confirms that this resolves the issue.
The discussion concludes with pfaffman and david discussing the possibility of a migration issue and how to prevent similar cases in the future. david explains that the selectable_avatars setting should store an empty list as an empty string, and Spitap clarifies that the issue occurred without any manual console interactions or imports.
I have an instance currently running on 2.9.0.beta4, and I needed to migrate it, so I did the basic backup/restore, but restore failed on the new instance. I decided then to try to update the original instance, but it failed also. Both failed, seemingly for the same reason, during the db:migrate command.
I had a similar error on my test site where I had some errant data in my selectable_avatar site setting, and had to update it through the rails console.
Are you comfortable using the rails console? If so, could you run this and see what it says:
Looks like you did it! You should see if you can get attention to this, as I’m pretty sure that migration is supposed to migrate those selectable avatars to the new format.
It is, and it’s worked in every other case we’ve seen. [] isn’t a valid value, even in the old format, so this particular case is quite surprising. Maybe it’s left over from some manual work on the console, or a bad import
If we get more reports, we’ll be sure to add an automated fix for this case.
Ah. Right. Usually when I get that error, it’s becuase I messed up such that I was accessing the wrong variable or something. But maybe that was the state that it was left in after all of the other ones had been deleted. But, really, I wasn’t paying close enough attention.
Our ‘list’ settings are a thin UI over pipe-delimited strings, so in theory an empty list should be stored as an empty string. But you make a good point - maybe someone was trying to empty the list and did something like this by accident:
Well in our case, the forum was set up at the beginning of this month, and no interactions with the console whatsoever (nor imports). In fact, I’ve discovered rails console today