This project is archived and is in readonly mode.

#2360 ✓stale

Debugging regression for conflicting param types

Reported by trappist | March 27th, 2009 @ 03:29 PM | in 3.x

In Rails 2.1.x (and possibly 2.2.x but I don't have an app to test) if you pass conflicting parameter types like ?x=&x[y]= we get a stack trace with helpful information:

Conflicting types for parameter containers. Expected an instance of Hash but found an instance of String. This can be caused by colliding Array and Hash parameters like qs[]=value&qs[key]=value. (The parameters received were "".)

In 2.3 (and maybe 2.2) we get something much less helpful, making the problem potentially difficult to track down:

/!\ FAILSAFE /!\ 2009-03-27 Status: 500 Internal Server Error You have a nil object when you didn't expect it! The error occurred while evaluating nil.each_pair

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/hash/indifferent_access.rb:46:in `update'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/hash/indifferent_access.rb:91:in `merge'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:381:in `parameters'


Nowhere in the stack trace does it point to a line of your application's code, and nowhere is there a hint that such a pair of parameters has sneaked in. Hopefully this doesn't come up often, but given the previous existence of such a useful error message, I imagine I'm not the first person to do this and have to spend time tracking it down, so it would be nice to have this back.

Comments and changes to this ticket

  • krani1 (at 0x82)

    krani1 (at 0x82) September 1st, 2009 @ 11:20 AM

    Just to confirm I had this problem too in 2.3 and had no idea where the problem was until I read this ticket. Thank you for that!

  • Jón Grétar Borgþórsson

    Jón Grétar Borgþórsson November 27th, 2009 @ 02:32 PM

    One thing to add to people who find this ticket here looking for the error.

    I got this because of a javascript price formatter. The javascript worked by taking specific input fields, hiding it, and creating a new text field with _formatted added to the end of the name.

    Thus there were 2 fields with the names: product[price] and product[price]_formatted.

    Having this will output this error. Just thought I would add this here for people googling the error. I found this problem when upgrading an app from 2.1.1 to 2.3.4.

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:40 PM

    • State changed from “new” to “open”
    • Importance changed from “” to “”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:40 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket