As I have now spent a second time 2 hours to google this error message and messed around figureing out why this happens I have to write it down.

In my situation I tried to import a set of data a got through the Facebook Graph Api using fbgraph. My database is postgres.

I had a second time the read on Yehuda Katz’ blog about Ruby 1.9 and its character encoding (great read btw), however didn’t really help me.

After not finding any solution I started to remove some parameters on my insert statement and finally found out, that the problem has nothing to do with encodings, so its completely misleading, but with the length of the Facebook ID. Facebook IDs need a BIGINT column type in the database, not an INTEGER, so I quickly migrated my db to change the type.

below how you do it on Postgres

change_column :fanpages, :fb_id, :integer, :limit => 8