fluent/fluentd · error · Fluent::ConfigError

in chunk_keys: #{e.message}

Error message

in chunk_keys: #{e.message}

What it means

This is a wrapper error: while validating chunk keys, `Fluent::PluginHelper::RecordAccessor::Accessor.parse_parameter(key)` raised an exception, and output.rb re-raises it prefixed with `in chunk_keys:`. It means the chunk key is not valid record-accessor syntax at all (malformed dot notation, dangling separators, stray characters).

Source

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

          # When @buffering.nil?, @buffer_config was initialized with default value for all parameters.
          # If so, this configuration MUST success.
          @chunk_keys = @buffer_config.chunk_keys.dup
          @chunk_key_time = !!@chunk_keys.delete('time')
          @chunk_key_tag = !!@chunk_keys.delete('tag')
          if @chunk_keys.any? { |key|
              begin
                k = Fluent::PluginHelper::RecordAccessor::Accessor.parse_parameter(key)
                if k.is_a?(String)
                  k !~ CHUNK_KEY_PATTERN
                else
                  if key.start_with?('$[')
                    raise Fluent::ConfigError, "in chunk_keys: bracket notation is not allowed"
                  else
                    false
                  end
                end
              rescue => e
                raise Fluent::ConfigError, "in chunk_keys: #{e.message}"
              end
            }
            raise Fluent::ConfigError, "chunk_keys specification includes invalid char"
          else
            @chunk_key_accessors = Hash[@chunk_keys.map { |key| [key.to_sym, Fluent::PluginHelper::RecordAccessor::Accessor.new(key)] }]
          end

          if @chunk_key_time
            raise Fluent::ConfigError, "<buffer ...> argument includes 'time', but timekey is not configured" unless @buffer_config.timekey
            Fluent::Timezone.validate!(@buffer_config.timekey_zone)
            @timekey_zone = @buffer_config.timekey_use_utc ? '+0000' : @buffer_config.timekey_zone
            @timekey = @buffer_config.timekey
            if @timekey <= 0
              raise Fluent::ConfigError, "timekey should be greater than 0. current timekey: #{@timekey}"
            end
            @timekey_use_utc = @buffer_config.timekey_use_utc
            @offset = Fluent::Timezone.utc_offset(@timekey_zone)
            @calculate_offset = @offset.respond_to?(:call) ? @offset : nil

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Fix the accessor syntax: `$.field` or `$.nested.field` for nested keys, plain `field` for top-level keys
  2. Use a plain top-level key name when the value is not nested
  3. Verify the exact key string with `fluentd --dry-run` before deploying

Example fix

# before
<buffer $.logs..app_id>
  @type file
</buffer>

# after
<buffer $.logs.app_id>
  @type file
</buffer>
Defensive patterns

Strategy: validation

Validate before calling

fluentd --dry-run -c /etc/fluent/fluent.conf
# Optionally pre-validate keys in Ruby:
# Fluent::PluginHelper::RecordAccessor::Accessor.parse_parameter('$.a.b') rescue puts 'bad key'

Prevention

When it happens

Trigger: Chunk keys like `$.` (dangling dot), `$.foo..bar`, `$.foo[` (unbalanced bracket), or any key string that `parse_parameter` cannot tokenize — the rescue at output.rb:320 catches the parse exception and re-raises its message with the prefix.

Common situations: Hand-written buffer sections with typos; keys generated from templates or environment variables that leave artifacts (`.`, `$`, empty segments); copy/paste from docs where a placeholder was only partially replaced.

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


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