ruby-grape/grape · error · Grape::Exceptions::UnknownParamsBuilder
unknown params_builder: %{params_builder_type}
Error message
unknown params_builder: %{params_builder_type} What it means
Params builders construct the `params` object handed to endpoints (hash-like classes registered in Grape::ParamsBuilder's registry). Setting `builder: X` to a name that is not registered - the built-ins are :hash, :hashie_mash, and :hash_with_indifferent_access - raises Grape::Exceptions::UnknownParamsBuilder at endpoint definition time.
Source
Thrown at lib/grape/params_builder.rb:10
# frozen_string_literal: true
module Grape
module ParamsBuilder
extend Grape::Util::Registry
module_function
def params_builder_for(short_name)
raise Grape::Exceptions::UnknownParamsBuilder, short_name unless registry.key?(short_name)
registry[short_name]
end
end
end
View on GitHub (pinned to 22d7975629)
Solutions
- Use a registered short name: `builder: :hash`, `builder: :hashie_mash`, or `builder: :hash_with_indifferent_access`.
- For custom builders, subclass Grape::ParamsBuilder::Base and implement `self.call(params)`; subclassing auto-registers the class under its underscored name.
Example fix
# before params do builder :mash # raises UnknownParamsBuilder requires :name, type: String end # after params do builder :hashie_mash requires :name, type: String end # custom class MyBuilder < Grape::ParamsBuilder::Base def self.call(params) = MyMash.new(params) end builder :my_builder
Defensive patterns
Strategy: validation
Validate before calling
BUILDERS = Grape::ParamsBuilder.send(:registry).keys # :hash, :hashie_mash, :hash_with_indifferent_access
raise ArgumentError, "builder must be one of #{BUILDERS.join(', ')}" unless BUILDERS.include?(builder_name) Type guard
def registered_builder?(name) = Grape::ParamsBuilder.send(:registry).key?(name)
Prevention
- Use the built-in short names; verify them in a console (`Grape::ParamsBuilder` registry keys).
- Subclass Grape::ParamsBuilder::Base for custom builders - registration is automatic on inheritance.
- Boot specs catch unregistered builder names at endpoint definition time.
When it happens
Trigger: `builder: :mash` (should be :hashie_mash). `builder: 'Hashie::Mash'` (a string class name instead of a registered short name). A custom builder class that subclasses something other than Grape::ParamsBuilder::Base, so it never gets registered.
Common situations: Migrating from Grape extensions (`Grape::Extensions::Hashie::Mash::ParamsBuilder`) to the short-name registry API. Typos in builder names. Custom mash-like param objects that need a registered builder class.
Related errors
- unknown :using for versioner: %{strategy}
- unknown validator: %{validator_type}
- type #{type} should support coercion via `[]`
- #declared is not available prior to parameter validation
- Representation of type #{representation.class} cannot be mer
AI-assisted analysis of ruby-grape/grape@22d7975629 (2026-08-21).
Data as JSON: /api/errors/e55f60c049e1bfef.
Report an issue: GitHub.