padrino/padrino-framework · error · Padrino::Routing::BlockArityError

route block arity does not match path '#{path}' (#{block_ari

Error message

route block arity does not match path '#{path}' (#{block_arity} for #{required_arity})

What it means

Error "route block arity does not match path '#{path}' (#{block_arity} for #{required_arity})" thrown in padrino/padrino-framework.

Source

Thrown at padrino-core/lib/padrino-core/application/routing.rb:563

            route.capture[option] = Array(captures).first
            true
          end
        end

        # Add Sinatra conditions.
        options.each do |option, args|
          option = :provides_format if option == :provides
          route.respond_to?(option) ? route.send(option, *args) : send(option, *args)
        end

        conditions, @conditions = @conditions, []
        route.custom_conditions.concat(conditions)

        invoke_hook(:padrino_route_added, route, verb, path, args, options, block)

        block_parameter_length = route.block_parameter_length
        if block_arity.positive? && block_parameter_length != block_arity
          raise BlockArityError.new(route.path, block_arity, block_parameter_length)
        end

        # Add Application defaults.
        route.before_filters << @filters[:before]
        route.after_filters << @filters[:after]
        if @_controller
          route.use_layout = @layout
          route.controller = Array(@_controller).join('/')
        end

        deferred_routes[priority] << [route, block]

        route
      end

      ##
      # Returns the final parsed route details (modified to reflect all
      # Padrino options) given the raw route. Raw route passed in could be

View on GitHub (pinned to 167044f3d5)

When it happens

Trigger: Thrown at padrino-core/lib/padrino-core/application/routing.rb:563 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23). Data as JSON: /api/errors/f7734e45231749a9. Report an issue: GitHub.