fluent/fluentd · critical · Fluent::ConfigError

Other '#{type_using_this_path}' plugin already uses same buf

Error message

Other '#{type_using_this_path}' plugin already uses same buffer path: type = #{type_of_owner}, buffer path = #{@path}

What it means

Fluentd keeps a per-process VariableStore registry (keyed by :buf_file_single) that maps each resolved buffer path to the plugin type that first claimed it. When a second output plugin's file_single buffer resolves to exactly the same path glob, configure raises Fluent::ConfigError to prevent two plugins from overwriting each other's chunk files. The check is skipped when called_in_test?.

Source

Thrown at lib/fluent/plugin/buf_file_single.rb:123

          @multi_workers_available = true
        else # specified path is file path
          if File.basename(@path).include?('.*.')
            new_path = File.join(File.dirname(@path), "fsb.*#{PATH_SUFFIX}")
            log.warn "file_single doesn't allow user specified 'prefix.*.suffix' style path. Use '#{new_path}' for file instead: #{@path}"
            @path = new_path
          elsif File.basename(@path).end_with?('.*')
            @path = @path + PATH_SUFFIX
          else
            # existing file will be ignored
            @path = @path + ".*#{PATH_SUFFIX}"
          end
          @multi_workers_available = false
        end

        type_of_owner = Plugin.lookup_type_from_class(@_owner.class)
        if @variable_store.has_key?(@path) && !called_in_test?
          type_using_this_path = @variable_store[@path]
          raise Fluent::ConfigError, "Other '#{type_using_this_path}' plugin already uses same buffer path: type = #{type_of_owner}, buffer path = #{@path}"
        end

        @variable_store[@path] = type_of_owner
        @dir_permission = if @dir_permission
                            @dir_permission.to_i(8)
                          else
                            system_config.dir_permission || Fluent::DEFAULT_DIR_PERMISSION
                          end
      end

      # This method is called only when multi worker is configured
      def multi_workers_ready?
        unless @multi_workers_available
          log.error "file_single buffer with multi workers should be configured to use directory 'path', or system root_dir and plugin id"
        end
        @multi_workers_available
      end

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Give each output plugin a distinct buffer path (e.g. append the tag or plugin name: path /var/log/fluent/buffer/out_fwd1)
  2. Alternatively give each plugin a unique @id and rely on root_dir so paths become per-plugin automatically
  3. Restart the fluentd process (not just reload) so the VariableStore is reset when a stale entry is suspected
  4. Check the error text: it names the plugin type that already owns the path — find that plugin in your config and differentiate its path

Example fix

# before
<match a.**>
  @type forward
  <buffer> @type file_single path /var/log/fluent/buffer </buffer>
</match>
<match b.**>
  @type forward
  <buffer> @type file_single path /var/log/fluent/buffer </buffer>
</match>

# after
<match a.**>
  @type forward
  <buffer> @type file_single path /var/log/fluent/buffer/a </buffer>
</match>
<match b.**>
  @type forward
  <buffer> @type file_single path /var/log/fluent/buffer/b </buffer>
</match>
Defensive patterns

Strategy: validation

Validate before calling

# Before starting, assert no two file_single buffers share a resolved path
paths = config.outputs.flat_map { |o| o.buffers.map(&:resolved_path) }
dupes = paths.group_by(&:itself).select { |_, v| v.size > 1 }.keys
abort "duplicate buffer paths: #{dupes.join(', ')}" unless dupes.empty?

# Or check the running registry:
store = Fluent::VariableStore.fetch_or_build(:buf_file_single)
store.each { |path, type| puts "#{type} owns #{path}" }

Try / catch

begin
  agent = Fluent::Agent.new(log).configure(conf)
rescue Fluent::ConfigError => e
  if e.message.include?('already uses same buffer path')
    # e names the owning plugin type and the contested path; make paths unique and retry
    retry_after_fixing_paths(e.message)
  else
    raise
  end
end

Prevention

When it happens

Trigger: Two <match> or <label> blocks whose file_single buffers resolve to the same path string, e.g. both specify path /var/log/fluent/buffer, or both use the same default path derived from root_dir because they share the same misconfigured @id; also happens when the first plugin was not stopped (variable_store entry not deleted in #stop) before a reload/re-dry-run in the same process.

Common situations: Copy-pasting an output block and forgetting to change the buffer path; using the same @id for two plugins; running fluentd --dry-run twice in-process in test harnesses without called_in_test? being true; supervisor hot-reload scenarios where stop hooks did not run.

Related errors


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