Forum: Ruby on Rails syntax error, unexpected tRPAREN raised in server log

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2013-08-22 10:59
(Received via mailing list)
In my server log, I am seeing this error message that is raised in

2013-08-12T23:06:08.932580+00:00 app[web.2]: SyntaxError
syntax error, unexpected tRPAREN
2013-08-12T23:06:08.932580+00:00 app[web.2]:
2013-08-12T23:06:08.932580+00:00 app[web.2]: def () value = nil
2013-08-12T23:06:08.932580+00:00 app[web.2]: ^):
2013-08-12T23:06:08.932580+00:00 app[web.2]:
app/controllers/api/users_controller.rb:42:in `show'
2013-08-12T23:06:08.932580+00:00 app[web.2]:
2013-08-12T23:06:08.932580+00:00 app[web.2]:

Any idea what would have caused it?

The code I have looked like this:
@user =

I cannot reproduce this but this error show up in the log occasionally.
Matt Jones (Guest)
on 2013-08-23 14:28
(Received via mailing list)
On Wednesday, 21 August 2013 16:51:11 UTC-4, wrote:
> 2013-08-12T23:06:08.932580+00:00 app[web.2]:
> app/controllers/api/users_controller.rb:42:in `show'
"def () value = nil" is not valid syntax. Wherever that is in your code,
you need to fix it...

--Matt Jones
unknown (Guest)
on 2013-08-23 21:22
(Received via mailing list)
This is my code,

user controller 42:
@user =

active support code that error out.

def define_callbacks(kind, object) #:nodoc:
name = _callback_runner_name(kind)
unless object.respond_to?(name, true)
  str = object.send("#{kind}_callbacks").compile
  class_eval <<-RUBY_EVAL, __FILE, LINE + 1
    def #{name}() #{str} end
    protected :#{name}

So some how active support try to eval a "def () value = nil" here.
mean #{name} is empty?

I thought the code ...

object.respond_to?(name, true) is intended to prevent cases where name
empty or nil. But when the #{name} used in the class_eval came from
_callback_runner_name(kind) and has nothing to do with

So I am not sure if the code is checking the wrong thing when checking
object.respond_to?(name, true)

And I dont know at what instance would _callback_runner_name(kind)
empty for me. Any idea what these code was intended to do. In the case
_callback_runner_name(kind)  is returning empty, I am not sure how this
will be my code causing the issue at the moment.

[363, 372] in

   363        # This method defines callback chain method for the given

   364        # if it was not yet defined.

   365        # This generated method plays caching role.

   366        def __define_callbacks(kind, object) #:nodoc:

   367   debugger

=> 368   name = __callback_runner_name(kind)

   369          unless object.respond_to?(name, true)

   370            str = object.send("_#{kind}_callbacks").compile

   371            class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1

   372              def #{name}() #{str} end


name = __callback_runner_name(kind)

(rdb:1) name = __callback_runner_name(kind)


(rdb:1) kind


(rdb:1) str


(rdb:1) object.send("_#{kind}_callbacks").compile

"value = nil\nhalted = false\nvalue = !halted && (!block_given? ||

(rdb:1) object

#<ClientMembership id: 1, client_id: 1, user_id: 1, is_client_admin:
created_at: "2013-06-18 20:23:13", updated_at: "2013-06-18 20:23:13">


unknown (Guest)
on 2013-08-28 20:54
(Received via mailing list)
The code in activesupport that is causing this is removed in Master
so I think the question is irrelevant now as the problem will no longer
an issue once it is released.
This topic is locked and can not be replied to.