fluent/fluentd · error · Fluent::ConfigError

Failed to setup secondary plugin in '#{conf['@type']}'. '#{s

Error message

Failed to setup secondary plugin in '#{conf['@type']}'. '#{secondary_type}' plugin in not allowed due to non buffered output

What it means

The plugin instantiated for `<secondary>` does not respond to `acts_as_secondary`, meaning the class registered for that `@type` is not a Fluentd v1 output plugin. All modern outputs inherit `Fluent::Plugin::Output` (which defines `acts_as_secondary`), so this fires for non-output types, legacy/incompatible plugin classes, or plugins whose registration is broken.

Source

Thrown at lib/fluent/plugin/output.rb:415

          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") &&
             (self.class != @secondary.class) &&
             (@custom_format || @secondary.implement?(:custom_format))
            log.warn "Use different plugin for secondary. Check the plugin works with primary like secondary_file", primary: self.class.to_s, secondary: @secondary.class.to_s
          end
        else
          @secondary = nil
        end

        self
      end

      def read_wait_to_kill_service_timeout
        if Fluent.windows?
          begin

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Use `@type secondary_file`, the purpose-built secondary plugin
  2. Use a current v1-output plugin (updated gem version) that supports buffered writes
  3. Set an explicit `@type` in `<secondary>` and verify it is an output plugin (`fluent-gem list`, plugin README)

Example fix

# before
<secondary>
  @type buf_file
  path /var/log/fluent/backup
</secondary>

# after
<secondary>
  @type secondary_file
  directory /var/log/fluent/backup
</secondary>
Defensive patterns

Strategy: validation

Validate before calling

fluentd --dry-run -c /etc/fluent/fluent.conf
# verify the gem provides a v1 output: fluent-gem list | grep <plugin>

Prevention

When it happens

Trigger: `<secondary> @type tail` (an input plugin), `@type buf_file` (a buffer plugin), an old v0.12-only output gem, or any type whose registered class lacks `acts_as_secondary`; `Plugin.new_output(secondary_type)` returns it and the `respond_to?` check at output.rb:414 fails. Also triggered when `@type` is omitted in `<secondary>` and the primary's type is re-used but is itself not secondary-capable.

Common situations: Pointing `<secondary>` at whatever plugin name seems related (a buffer, an input, a filter); using unmaintained gems after a fluentd major upgrade changed the plugin API.

Related errors


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