fluent/fluentd · error · Fluent::ConfigError
Invalid <secondary> section for non-buffered plugin
Error message
Invalid <secondary> section for non-buffered plugin
What it means
A `<secondary>` section was configured under an output plugin that does not buffer at all (`@buffering` is false, i.e. the plugin only implements synchronous `#process`). Secondary output exists solely to receive buffered chunks after retry limits, so it is meaningless — and rejected — for non-buffered outputs, which have no retry queue.
Source
Thrown at lib/fluent/plugin/output.rb:401
end
end
end
if (@flush_mode != :interval) && buffer_conf.has_key?('flush_interval')
if buffer_conf.has_key?('flush_mode')
raise Fluent::ConfigError, "'flush_interval' can't be specified when 'flush_mode' is not 'interval' explicitly: '#{@flush_mode}'"
else
log.warn "'flush_interval' is ignored because default 'flush_mode' is not 'interval': '#{@flush_mode}'"
end
end
if @buffer.queued_chunks_limit_size.nil?
@buffer.queued_chunks_limit_size = @buffer_config.flush_thread_count
end
end
if @secondary_config
raise Fluent::ConfigError, "Invalid <secondary> section for non-buffered plugin" unless @buffering
raise Fluent::ConfigError, "<secondary> section cannot have <buffer> section" if @secondary_config.buffer
raise Fluent::ConfigError, "<secondary> section cannot have <secondary> section" if @secondary_config.secondary
if @buffer_config.retry_forever
log.warn "<secondary> with 'retry_forever', only unrecoverable errors are moved to secondary"
end
secondary_type = @secondary_config[:@type]
unless secondary_type
secondary_type = conf['@type'] # primary plugin type
end
secondary_conf = conf.elements(name: 'secondary').first
@secondary = Plugin.new_output(secondary_type)
unless @secondary.respond_to?(:acts_as_secondary)
raise Fluent::ConfigError, "Failed to setup secondary plugin in '#{conf['@type']}'. '#{secondary_type}' plugin in not allowed due to non buffered output"
end
@secondary.acts_as_secondary(self)
@secondary.configure(secondary_conf)
if (@secondary.class.to_s != "Fluent::Plugin::SecondaryFileOutput") &&View on GitHub (pinned to dd45c6e18d)
Solutions
- Remove the `<secondary>` section from the non-buffered output
- Use `@type copy` with two destinations if the goal is dual delivery, not failover
- Switch the primary to a buffered output (file, forward, s3, ...) if you actually need retry + secondary semantics
Example fix
# before
<match app.**>
@type stdout
<secondary>
@type secondary_file
directory /var/log/fluent/backup
</secondary>
</match>
# after (stdout is synchronous; no secondary is possible)
<match app.**>
@type stdout
</match> Defensive patterns
Strategy: validation
Validate before calling
fluentd --dry-run -c /etc/fluent/fluent.conf
Type guard
null
Prevention
- Remember `<secondary>` requires a buffered primary (file/forward/s3...)
- Use `copy` for fan-out, `<secondary>` only for retry fallback
- Dry-run catches this before any traffic flows
When it happens
Trigger: `<match **> @type stdout ... <secondary> ... </secondary>` or `@type copy`/`@type null` with a nested `<secondary>` element; `@secondary_config` is non-nil while `@buffering` is false, so output.rb:401 raises during configure.
Common situations: Pasting a `<secondary>` block into a config whose primary was switched to a synchronous plugin; misunderstanding that `<secondary>` is not a general 'send a copy elsewhere' directive (that is `<match>` + copy).
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- secondary plugin '#{self.class}' must support buffering, but
- secondary plugin '#{self.class}' must support buffering, but
- <secondary> section cannot have <buffer> section
- buffer path is not configured. specify 'path' in <buffer>
- This plugin can only be used in the <secondary> section
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/549393b76a38995a.
Report an issue: GitHub.