{"record":{"id":"726a5d4d72e75d18","repo":"ViewComponent/view_component","slug":"template-errors","errorCode":null,"errorMessage":"TEMPLATE_ERRORS","messagePattern":"TEMPLATE_ERRORS","errorType":"exception","errorClass":"ViewComponent::TemplateError","httpStatus":null,"severity":"error","filePath":"lib/view_component/compiler.rb","lineNumber":38,"sourceCode":"    end\n\n    def compile(raise_errors: false, force: false)\n      return if compiled? && !force\n      return if @component == ViewComponent::Base\n\n      @lock.synchronize do\n        # this check is duplicated so that concurrent compile calls can still\n        # early exit\n        return if compiled? && !force\n\n        gather_templates\n\n        if self.class.__vc_development_mode && @templates.any?(&:requires_compiled_superclass?)\n          @component.superclass.__vc_compile(raise_errors: raise_errors)\n        end\n\n        if template_errors.present?\n          raise TemplateError.new(template_errors) if raise_errors\n\n          # this return is load bearing, and prevents the component from being considered \"compiled?\"\n          return false\n        end\n\n        if raise_errors\n          @component.__vc_validate_initialization_parameters!\n          @component.__vc_validate_collection_parameter!\n        end\n\n        define_render_template_for\n\n        @component.__vc_register_default_slots\n        @component.__vc_build_i18n_backend\n\n        CompileCache.register(@component)\n\n        @component.after_compile","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/ViewComponent/view_component/blob/9f22c36fa7d7b44098a8ed97472e3b4674ae420f/lib/view_component/compiler.rb#L20-L56","documentation":"Error \"TEMPLATE_ERRORS\" thrown in ViewComponent/view_component.","triggerScenarios":"Thrown at lib/view_component/compiler.rb:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a template: create a sidecar template file (e.g. my_component.html.erb) next to the component class, or define an inline `call` method or `erb_template` in the component.","Resolve duplicate templates: the component must not define multiple templates for the same variants/formats, nor both an inline template and a sidecar template.","Fix any template syntax errors reported in the error detail."],"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"}