{"record":{"id":"5a359a445349dcc0","repo":"fluent/fluentd","slug":"chunk-keys-specification-includes-invalid-char","errorCode":null,"errorMessage":"chunk_keys specification includes invalid char","messagePattern":"chunk_keys specification includes invalid char","errorType":"validation","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/output.rb","lineNumber":324,"sourceCode":"          @chunk_key_time = !!@chunk_keys.delete('time')\n          @chunk_key_tag = !!@chunk_keys.delete('tag')\n          if @chunk_keys.any? { |key|\n              begin\n                k = Fluent::PluginHelper::RecordAccessor::Accessor.parse_parameter(key)\n                if k.is_a?(String)\n                  k !~ CHUNK_KEY_PATTERN\n                else\n                  if key.start_with?('$[')\n                    raise Fluent::ConfigError, \"in chunk_keys: bracket notation is not allowed\"\n                  else\n                    false\n                  end\n                end\n              rescue => e\n                raise Fluent::ConfigError, \"in chunk_keys: #{e.message}\"\n              end\n            }\n            raise Fluent::ConfigError, \"chunk_keys specification includes invalid char\"\n          else\n            @chunk_key_accessors = Hash[@chunk_keys.map { |key| [key.to_sym, Fluent::PluginHelper::RecordAccessor::Accessor.new(key)] }]\n          end\n\n          if @chunk_key_time\n            raise Fluent::ConfigError, \"<buffer ...> argument includes 'time', but timekey is not configured\" unless @buffer_config.timekey\n            Fluent::Timezone.validate!(@buffer_config.timekey_zone)\n            @timekey_zone = @buffer_config.timekey_use_utc ? '+0000' : @buffer_config.timekey_zone\n            @timekey = @buffer_config.timekey\n            if @timekey <= 0\n              raise Fluent::ConfigError, \"timekey should be greater than 0. current timekey: #{@timekey}\"\n            end\n            @timekey_use_utc = @buffer_config.timekey_use_utc\n            @offset = Fluent::Timezone.utc_offset(@timekey_zone)\n            @calculate_offset = @offset.respond_to?(:call) ? @offset : nil\n            @output_time_formatter_cache = {}\n          end\n","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/output.rb#L306-L342","documentation":"A plain (non-accessor) chunk key contains characters outside `CHUNK_KEY_PATTERN = /^[-_.@a-zA-Z0-9]+$/`. Chunk keys become part of buffer chunk metadata (and often file paths), so Fluentd restricts them to letters, digits, `-`, `_`, `.`, and `@`. Anything else — spaces, slashes, `#`, unicode, leftover `$` — fails configuration.","triggerScenarios":"`<buffer my key>` (embedded space from an unquoted list), `<buffer a/b>`, `<buffer key#1>`, or a key containing `$` that did not parse as a record accessor. The `k !~ CHUNK_KEY_PATTERN` check at output.rb:312 returns true and the error is raised.","commonSituations":"Splitting a comma/space separated list of keys incorrectly; pasting keys from spreadsheets or URLs (slashes, colons); locale-specific characters in key names.","solutions":["Rewrite the key to use only `[A-Za-z0-9_-.@]` characters","For nested fields, switch to dot-notation accessor form `$.a.b`, which is validated separately","Rename the record field upstream (record_transformer) if you cannot change the key"],"exampleFix":"# before\n<buffer tenant id>\n  @type file\n</buffer>\n\n# after\n<buffer tenant,id>\n  @type file\n</buffer>","handlingStrategy":"validation","validationCode":"KEY_RE = /\\A[-_.@a-zA-Z0-9]+\\z/\nkeys = %w[tenant id]\ninvalid = keys.reject { |k| k.match?(KEY_RE) }\nabort \"invalid chunk key chars: #{invalid.join(', ')}\" unless invalid.empty?\nfluentd --dry-run -c /etc/fluent/fluent.conf","typeGuard":"def valid_plain_chunk_key?(k)\n  k.match?(%r{\\A[-_.@a-zA-Z0-9]+\\z})\nend","tryCatchPattern":null,"preventionTips":["Allow only [A-Za-z0-9_-.@] in chunk keys by convention","Do not build chunk keys from free-form user input","Dry-run configs in CI"],"tags":["fluentd","buffer","chunk-keys","validation"],"backgroundTag":"config-validation-failed","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}