{"record":{"id":"249d936316f751a6","repo":"fluent/fluentd","slug":"secondary-section-cannot-have-buffer-section","errorCode":null,"errorMessage":"<secondary> section cannot have <buffer> section","messagePattern":"<secondary> section cannot have <buffer> section","errorType":"validation","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/output.rb","lineNumber":402,"sourceCode":"            end\n          end\n\n          if (@flush_mode != :interval) && buffer_conf.has_key?('flush_interval')\n            if buffer_conf.has_key?('flush_mode')\n              raise Fluent::ConfigError, \"'flush_interval' can't be specified when 'flush_mode' is not 'interval' explicitly: '#{@flush_mode}'\"\n            else\n              log.warn \"'flush_interval' is ignored because default 'flush_mode' is not 'interval': '#{@flush_mode}'\"\n            end\n          end\n\n          if @buffer.queued_chunks_limit_size.nil?\n            @buffer.queued_chunks_limit_size = @buffer_config.flush_thread_count\n          end\n        end\n\n        if @secondary_config\n          raise Fluent::ConfigError, \"Invalid <secondary> section for non-buffered plugin\" unless @buffering\n          raise Fluent::ConfigError, \"<secondary> section cannot have <buffer> section\" if @secondary_config.buffer\n          raise Fluent::ConfigError, \"<secondary> section cannot have <secondary> section\" if @secondary_config.secondary\n          if @buffer_config.retry_forever\n            log.warn \"<secondary> with 'retry_forever', only unrecoverable errors are moved to secondary\"\n          end\n\n          secondary_type = @secondary_config[:@type]\n          unless secondary_type\n            secondary_type = conf['@type'] # primary plugin type\n          end\n          secondary_conf = conf.elements(name: 'secondary').first\n          @secondary = Plugin.new_output(secondary_type)\n          unless @secondary.respond_to?(:acts_as_secondary)\n            raise Fluent::ConfigError, \"Failed to setup secondary plugin in '#{conf['@type']}'. '#{secondary_type}' plugin in not allowed due to non buffered output\"\n          end\n          @secondary.acts_as_secondary(self)\n          @secondary.configure(secondary_conf)\n          if (@secondary.class.to_s != \"Fluent::Plugin::SecondaryFileOutput\") &&\n             (self.class != @secondary.class) &&","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/output.rb#L384-L420","documentation":"A `<buffer>` block was nested inside the `<secondary>` block. The secondary plugin is driven by the primary's buffer (it receives the primary's failed chunks), so it cannot define its own buffer section; the configuration parser finds `@secondary_config.buffer` set and rejects it.","triggerScenarios":"`<secondary> @type file <buffer> ... </buffer> </secondary>` — any buffer subsection inside `<secondary>` triggers the `@secondary_config.buffer` check at output.rb:402 during configure.","commonSituations":"Copy/pasting the primary plugin's full body (including its `<buffer>` tuning) into the `<secondary>` block; assuming the secondary needs matching buffer settings to work.","solutions":["Delete the `<buffer>` section from inside `<secondary>`","Leave buffer tuning (flush_interval, retry_*, timekey) on the primary's `<buffer>` only","Keep only plugin-specific parameters (e.g. `directory` for secondary_file) inside `<secondary>`"],"exampleFix":"# before\n<secondary>\n  @type secondary_file\n  directory /var/log/fluent/backup\n  <buffer>\n    flush_interval 1s\n  </buffer>\n</secondary>\n\n# after\n<secondary>\n  @type secondary_file\n  directory /var/log/fluent/backup\n</secondary>","handlingStrategy":"validation","validationCode":"fluentd --dry-run -c /etc/fluent/fluent.conf","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep `<secondary>` blocks minimal: @type plus plugin-specific params only","All buffer/retry tuning lives on the primary's `<buffer>`","Template your secondary as `<secondary> @type secondary_file directory ... </secondary>`"],"tags":["fluentd","secondary","buffer","configuration"],"backgroundTag":"config-validation-failed","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}