fluent/fluentd · error · Fluent::ConfigError

duplicated parsers configured: #{section.usage}

Error message

duplicated parsers configured: #{section.usage}

What it means

Fluent::ConfigError raised in the Parser helper's configure. Each <parse> section is registered in @_parsers keyed by its usage label (the name in <parse mylabel>, or '' when unlabelled). A second section with the same usage would overwrite the first parser instance, so configure aborts listing the duplicated usage.

Source

Thrown at lib/fluent/plugin_helper/parser.rb:87

      def self.included(mod)
        mod.include ParserParams
      end

      attr_reader :_parsers # for tests

      def initialize
        super
        @_parsers_started = false
        @_parsers = {} # usage => parser
      end

      def configure(conf)
        super

        @parser_configs.each do |section|
          if @_parsers[section.usage]
            raise Fluent::ConfigError, "duplicated parsers configured: #{section.usage}"
          end
          parser = Plugin.new_parser(section[:@type], parent: self)
          parser.configure(section.corresponding_config_element)
          @_parsers[section.usage] = parser
        end
      end

      def start
        super
        @_parsers_started = true
        @_parsers.each_pair do |usage, parser|
          parser.start
        end
      end

      def parser_operate(method_name, &block)
        @_parsers.each_pair do |usage, parser|
          begin

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Label each <parse> section uniquely, e.g. <parse json_p> and <parse csv_p>, and fetch them with parser_create(usage: 'json_p')
  2. Remove the duplicated <parse> block when only one parser is needed

Example fix

# before
<source>
  @type tail
  <parse>
    @type json
  </parse>
  <parse>
    @type none
  </parse>
</source>

# after
<source>
  @type tail
  <parse json_p>
    @type json
  </parse>
  <parse raw_p>
    @type none
  </parse>
</source>
Defensive patterns

Strategy: validation

Validate before calling

usages = @parser_configs.map(&:usage)
if usages.uniq.size != usages.size
  dup = usages.find { |u| usages.count(u) > 1 }
  raise Fluent::ConfigError, "duplicate <parse> label: #{dup.inspect}"
end

Prevention

When it happens

Trigger: Two <parse> sections in one plugin block with colliding labels: two bare <parse> sections (both usage '') or two <parse with_prefix> sections; raised during #configure before start.

Common situations: Adding a second parser by duplicating an existing <parse> block and forgetting to relabel it; assuming multiple unlabelled <parse> sections are allowed.

Related errors


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