# SSO 500 Error: Failed to create or lookup user: no implicit conversion of Array into String

**URL:** <https://meta.discourse.org/t/sso-500-error-failed-to-create-or-lookup-user-no-implicit-conversion-of-array-into-string/51422>\
**Category:** Bug\
**Created:** [11 Ottobre 2016, 7:05pm UTC](https://meta.discourse.org/t/sso-500-error-failed-to-create-or-lookup-user-no-implicit-conversion-of-array-into-string/51422 "2016-10-11T19:05:50Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)\
**Post date:** [14 Ottobre 2016, 8:23am UTC](https://meta.discourse.org/t/sso-500-error-failed-to-create-or-lookup-user-no-implicit-conversion-of-array-into-string/51422/7 "2016-10-14T08:23:11Z")

</div>

There are two problems here:

1. Accessing a plugin custom fields may return a `String` or an `Array` and there isn’t any protection for plugin authors here. If I do `user_custom_fields["date_of_birth"] = "2016-05-02"` I should ideally always get back a `String` if I retrieve the custom fields again. Currently, accessing custom fields may return an `Array` if custom fields with the same name and user\_id is somehow set around the same time. This is not ideal IMO as either all access to a plugin custom fields will have to be accompanied by a check to see if it is an `Array` or `String` or a lock has to be used when setting any custom field.

2. Maintaining a valid date as a String is not ideal. Initially when I started working on the plugin, we decided to store the date in a `UserCustomField` instead of `User#date_of_birth` because the requirements for the plugin was simple and we can get away with it even if the `date_of_birth` is invalid. Right now, we use the date of birth field in more places and an invalid format will just blow things up. I’ll look to see if I can migrate custom fields into `User#date_of_birth` to ensure consistency in the date format.

---

_[View the full topic](https://meta.discourse.org/t/sso-500-error-failed-to-create-or-lookup-user-no-implicit-conversion-of-array-into-string/51422)._
