{"record":{"id":"247066110d58beda","repo":"ViewComponent/view_component","slug":"component-declares-a-slot-named-slot-name-which-i","errorCode":null,"errorMessage":"COMPONENT declares a slot named SLOT_NAME, which is a reserved word in the ViewComponent framework.\n\nTo fix this issue, choose a different name.","messagePattern":"COMPONENT declares a slot named SLOT_NAME, which is a reserved word in the ViewComponent framework\\.\n\nTo fix this issue, choose a different name\\.","errorType":"exception","errorClass":"ViewComponent::ReservedPluralSlotNameError","httpStatus":null,"severity":"error","filePath":"lib/view_component/slotable.rb","lineNumber":308,"sourceCode":"        elsif callable.is_a?(String)\n          # If callable is a string, we assume it's referencing an internal class\n          slot[:renderable_class_name] = callable\n        elsif callable.respond_to?(:call)\n          # If slot doesn't respond to `render_in`, we assume it's a proc,\n          # define a method, and save a reference to it to call when setting\n          method_name = :\"_call_#{slot_name}\"\n          define_method method_name, &callable\n          slot[:renderable_function] = instance_method(method_name)\n        else\n          raise(InvalidSlotDefinitionError)\n        end\n\n        slot\n      end\n\n      def __vc_validate_plural_slot_name(slot_name)\n        if RESERVED_NAMES[:plural].include?(slot_name.to_sym)\n          raise ReservedPluralSlotNameError.new(name, slot_name)\n        end\n\n        __vc_raise_if_slot_name_uncountable(slot_name)\n        __vc_raise_if_slot_conflicts_with_call(slot_name)\n        __vc_raise_if_slot_ends_with_question_mark(slot_name)\n        __vc_raise_if_slot_registered(slot_name)\n      end\n\n      def __vc_validate_singular_slot_name(slot_name)\n        if slot_name.to_sym == :content\n          raise ContentSlotNameError.new(name)\n        end\n\n        if RESERVED_NAMES[:singular].include?(slot_name.to_sym)\n          raise ReservedSingularSlotNameError.new(name, slot_name)\n        end\n\n        __vc_raise_if_slot_conflicts_with_call(slot_name)","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/ViewComponent/view_component/blob/9f22c36fa7d7b44098a8ed97472e3b4674ae420f/lib/view_component/slotable.rb#L290-L326","documentation":"Raised when a plural slot name is :contents or :renders, the values of ViewComponent::Slotable::RESERVED_NAMES[:plural] (lib/view_component/slotable.rb:11-14, check at :307). Plural names reach this check directly from renders_many and indirectly from renders_one, which validates ActiveSupport::Inflector.pluralize(slot_name) at lib/view_component/slotable.rb:81. Every slot generates a getter, a predicate and with_ setters, and names built on render and contents would collide with the rendering API of Rails and ViewComponent, so they are reserved.","triggerScenarios":"renders_many :renders or renders_many :contents, the two entries of the plural reserved list. Singular forms take a different path: renders_one :render raises ReservedSingularSlotNameError and renders_one :content raises ContentSlotNameError during the singular validation that runs before the plural check.","commonSituations":"A collection of rendered items naturally named renders_many :renders; a list of text chunks named renders_many :contents; components migrated from the old content_areas DSL or from helper conventions where such names were allowed.","solutions":["Rename the slot to a name unrelated to render or content, for example renders_many :rendered_items or renders_many :content_blocks","If the slot only wraps block content, drop it and use the built-in content accessor"],"exampleFix":"# before\nclass SectionComponent < ViewComponent::Base\n  renders_many :renders # reserved plural name\nend\n\n# after\nclass SectionComponent < ViewComponent::Base\n  renders_many :rendered_items\nend","handlingStrategy":"validation","validationCode":"RESERVED_PLURAL_SLOT_NAMES = %i[contents renders].freeze\n\ndef plural_slot_name_available?(name)\n  RESERVED_PLURAL_SLOT_NAMES.exclude?(name.to_sym)\nend\n\nplural_slot_name_available?(:renders) # => false","typeGuard":null,"tryCatchPattern":"# guard config-driven registration only; hardcoded names should fail fast at boot\nbegin\n  renders_many(dynamic_name.to_sym, callable)\nrescue ViewComponent::ReservedPluralSlotNameError => e\n  raise ArgumentError, \"ViewComponent rejected the reserved slot name: #{e.message}\"\nend","preventionTips":["Keep the words render and content out of slot names in every singular and plural form","Name slots after the domain concept they hold, not after the rendering mechanism","Teach the component generator to reject the reserved names before generating code"],"tags":["ruby","rails","view-component","slots","reserved-words","naming"],"backgroundTag":"reserved-name-conflict","analyzedSha":"9f22c36fa7d7b44098a8ed97472e3b4674ae420f","analyzedAt":"2026-08-23T10:20:47.008Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}