I have looked further and I can confirm that zero length strings as keys will cause this. Nil values will convert to empty strings. So as a workaround until we fix this bug please validate the key provided to set_attribute.