fluent/fluentd · error · Fluent::ConfigError

Missing '@type' parameter in <store> section

Error message

Missing '@type' parameter in <store> section

What it means

Multi-output plugins (copy, redirect, etc. built on Fluent::Plugin::MultiOutput) instantiate one child output per <store> section via its @type. In configure, a store whose corresponding config element has no '@type' key raises before plugin instantiation — there is no way to know which output plugin to load.

Source

Thrown at lib/fluent/plugin/multi_output.rb:87

      def multi_output?
        true
      end

      def configure(conf)
        super

        @num_errors_metrics = metrics_create(namespace: "fluentd", subsystem: "multi_output", name: "num_errors", help_text: "Number of count num errors")
        @emit_count_metrics = metrics_create(namespace: "fluentd", subsystem: "multi_output", name: "emit_count", help_text: "Number of count emits")
        @emit_records_metrics = metrics_create(namespace: "fluentd", subsystem: "multi_output", name: "emit_records", help_text: "Number of emit records")
        @emit_size_metrics =  metrics_create(namespace: "fluentd", subsystem: "multi_output", name: "emit_size", help_text: "Total size of emit events")
        @enable_size_metrics = !!system_config.enable_size_metrics

        @stores.each do |store|
          store_conf = store.corresponding_config_element
          type = store_conf['@type']
          unless type
            raise Fluent::ConfigError, "Missing '@type' parameter in <store> section"
          end

          log.debug "adding store", type: type

          output = Fluent::Plugin.new_output(type)
          output.context_router = self.context_router
          output.configure(store_conf)
          @outputs << output
        end
      end

      def static_outputs
        @outputs_statically_created = true
        @outputs
      end

      # Child plugin's lifecycles are controlled by agent automatically.
      # It calls `outputs` to traverse plugins, and invoke start/stop/*shutdown/close/terminate on these directly.

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Add `@type` to every <store> — e.g. @type stdout, @type forward, @type file
  2. If using templated stores, assert the type key exists before rendering (fail the template early with a clearer message)
  3. Run `fluentd --dry-run -c fluent.conf` in CI to catch this class of config error before deploy

Example fix

# before
<match **>
  @type copy
  <store>
    @type stdout
  </store>
  <store>
    path /var/log/out.log
  </store>
</match>

# after
<match **>
  @type copy
  <store>
    @type stdout
  </store>
  <store>
    @type file
    path /var/log/out.log
  </store>
</match>
Defensive patterns

Strategy: validation

Validate before calling

conf.elements('store').each do |store|
  unless store['@type']
    raise ArgumentError, "<store> at #{store.unused} missing @type"
  end
end

Prevention

When it happens

Trigger: configure(conf) on a copy/routing output where a <store> block lacks `@type`, e.g. <store> <buffer>...</buffer> </store> or a bare <store> with only host/port keys pasted without the plugin line.

Common situations: Adding a third output branch to out_copy and forgetting @type; ERB loops emitting <store> from a hash that lost its type key; commenting out the @type line while debugging.

Related errors


AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21). Data as JSON: /api/errors/2ee4f89380b2fdcb. Report an issue: GitHub.