{"record":{"id":"b5218016029b478b","repo":"fluent/fluentd","slug":"duplicated-parsers-configured-section-usage","errorCode":null,"errorMessage":"duplicated parsers configured: #{section.usage}","messagePattern":"duplicated parsers configured: #(.+?)","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/parser.rb","lineNumber":87,"sourceCode":"\n      def self.included(mod)\n        mod.include ParserParams\n      end\n\n      attr_reader :_parsers # for tests\n\n      def initialize\n        super\n        @_parsers_started = false\n        @_parsers = {} # usage => parser\n      end\n\n      def configure(conf)\n        super\n\n        @parser_configs.each do |section|\n          if @_parsers[section.usage]\n            raise Fluent::ConfigError, \"duplicated parsers configured: #{section.usage}\"\n          end\n          parser = Plugin.new_parser(section[:@type], parent: self)\n          parser.configure(section.corresponding_config_element)\n          @_parsers[section.usage] = parser\n        end\n      end\n\n      def start\n        super\n        @_parsers_started = true\n        @_parsers.each_pair do |usage, parser|\n          parser.start\n        end\n      end\n\n      def parser_operate(method_name, &block)\n        @_parsers.each_pair do |usage, parser|\n          begin","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/parser.rb#L69-L105","documentation":"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.","triggerScenarios":"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.","commonSituations":"Adding a second parser by duplicating an existing <parse> block and forgetting to relabel it; assuming multiple unlabelled <parse> sections are allowed.","solutions":["Label each <parse> section uniquely, e.g. <parse json_p> and <parse csv_p>, and fetch them with parser_create(usage: 'json_p')","Remove the duplicated <parse> block when only one parser is needed"],"exampleFix":"# before\n<source>\n  @type tail\n  <parse>\n    @type json\n  </parse>\n  <parse>\n    @type none\n  </parse>\n</source>\n\n# after\n<source>\n  @type tail\n  <parse json_p>\n    @type json\n  </parse>\n  <parse raw_p>\n    @type none\n  </parse>\n</source>","handlingStrategy":"validation","validationCode":"usages = @parser_configs.map(&:usage)\nif usages.uniq.size != usages.size\n  dup = usages.find { |u| usages.count(u) > 1 }\n  raise Fluent::ConfigError, \"duplicate <parse> label: #{dup.inspect}\"\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Label every <parse> section when configuring more than one","Review copy-pasted <parse> blocks for repeated labels","Use distinct labels (json_p, csv_p) and select via parser_create(usage:)"],"tags":["fluentd","parser","configuration","duplicate"],"backgroundTag":"duplicate-config-section","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}