activeuuid icon indicating copy to clipboard operation
activeuuid copied to clipboard

Intermittent ActiveRecord::StatementInvalid: PG::CharacterNotInRepertoire Error

Open D1plo1d opened this issue 11 years ago • 7 comments
trafficstars

I'm getting the following error when I try to create a model with a UUID primary key in rails 4.0.2:

ActiveRecord::StatementInvalid: PG::CharacterNotInRepertoire: ERROR:  invalid byte sequence for encoding "UTF8": 0xd6 0x40

running reload! from the console seems to fix the problem so I'm wondering if this is a race condition in startup. I know rails added uuid's in 4 at some point and so I'm wondering if it's a conflict with the new uuid column type. Any ideas?

Full error: https://gist.github.com/D1plo1d/1f5a57b90e2a0d331a94

D1plo1d avatar Feb 10 '14 21:02 D1plo1d

Removing ActiveUUID fixes the problem. So the uuid column type patch should not be applied for rails 4.0.2+ (and possibly earlier versions as well).

D1plo1d avatar Feb 10 '14 21:02 D1plo1d

@D1plo1d can you please elaborate on this? I'm also noticing an issue with intermittent behavior, but it's reproducible in tests. Initial run of tests fail when using spring, but saving any file and re-running the tests they pass. I'm guessing this is similar to the reload you were doing. Do you know how to use this gem on rails 4.0.2+ and get consistent results?

claude avatar Feb 23 '15 21:02 claude

@claude Sorry, that was all from a year ago on my end. I can't recall the details of the issue any more then what I wrote above.

Edit: Not sure how to get the gem working consistently. Our solution was to removed it entirely.

D1plo1d avatar Feb 24 '15 03:02 D1plo1d

thanks for the response, so did you get uuid's working another way?

claude avatar Feb 24 '15 23:02 claude

Yeah. It's actually baked into Rails 4 so we just use the built in helpers now (instead of activeuuid). Here's an example:

http://johnkolovos.blogspot.ca/2014/10/rails-4-uuid.html

D1plo1d avatar Feb 24 '15 23:02 D1plo1d

Ahh, yeah that works great for postgres. Unfortunately mysql doesn't have a native uuid type and so you need this gem to do the string to binary conversion for you. That way you don't have to store the uuid as a string in mysqll. Thanks for the help though!

claude avatar Feb 25 '15 21:02 claude

np, good luck!

D1plo1d avatar Feb 25 '15 21:02 D1plo1d