{"record":{"id":"de0238e4b1101b00","repo":"ViewComponent/view_component","slug":"it-looks-like-a-block-was-provided-after-calling","errorCode":null,"errorMessage":"It looks like a block was provided after calling `with_content` on COMPONENT, which means that ViewComponent doesn't know which content to use.\n\nTo fix this issue, use either `with_content` or a block.","messagePattern":"It looks like a block was provided after calling `with_content` on COMPONENT, which means that ViewComponent doesn't know which content to use\\.\n\nTo fix this issue, use either `with_content` or a block\\.","errorType":"exception","errorClass":"ViewComponent::DuplicateContentError","httpStatus":null,"severity":"error","filePath":"lib/view_component/base.rb","lineNumber":133,"sourceCode":"      @output_buffer = view_context.output_buffer\n\n      @lookup_context = view_context.lookup_context\n\n      # For content_for\n      @view_flow = view_context.view_flow\n\n      # For i18n\n      @virtual_path ||= virtual_path\n\n      # Describes the inferred request constraints (locales, formats, variants)\n      @__vc_requested_details = @lookup_context.vc_requested_details\n\n      # For caching, such as #cache_if\n      @current_template = nil unless defined?(@current_template)\n      old_current_template = @current_template\n\n      if block && defined?(@__vc_content_set_by_with_content)\n        raise DuplicateContentError.new(self.class.name)\n      end\n\n      @__vc_content_evaluated = false\n      remove_instance_variable(:@__vc_content) if defined?(@__vc_content)\n      @__vc_render_in_block = block\n      @view_context.instance_variable_set(:@virtual_path, virtual_path)\n\n      before_render\n\n      if render?\n        value = nil\n\n        @output_buffer.with_buffer do\n          inner_rendered_template = nil\n          around_rendered_template = around_render do\n            inner_rendered_template = render_template_for(@__vc_requested_details).to_s\n          end\n","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/ViewComponent/view_component/blob/9f22c36fa7d7b44098a8ed97472e3b4674ae420f/lib/view_component/base.rb#L115-L151","documentation":"Error \"It looks like a block was provided after calling `with_content` on COMPONENT, which means that ViewComponent doesn't know which content to use.\n\nTo fix this issue, use either `with_content` or a block.\" thrown in ViewComponent/view_component.","triggerScenarios":"Thrown at lib/view_component/base.rb:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass content either with `with_content(value)` or with a render block, but not both: remove the block if you called `with_content`, or remove the `with_content` call if you render with a block.","Example: render(MyComponent.new) { 'content' } OR render(MyComponent.new.with_content('content'))."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9f22c36fa7d7b44098a8ed97472e3b4674ae420f","analyzedAt":"2026-08-23T10:20:47.008Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}