#5462·fluentd

BufferChunkOverflowError inside @ERROR loops forever - no buffer parameter can stop it

Author: tarun9715mCreated Aug 4, 2026Updated Aug 27, 2026
Labelswaiting-for-user

Describe the bug

If a record is larger than chunk_limit_size, the buffer raises BufferChunkOverflowError and the record is routed to @ERROR. If the output inside @ERROR also has a chunk_limit_size smaller than the record, it raises the same error, and the record is routed to @ERROR again. This repeats without bound.

None of the buffer's failure-handling parameters apply, because this error is raised at emit time rather than at flush time:

  • retry_max_times / retry_timeout govern flush failures. No flush has happened yet.
  • overflow_action governs BufferOverflowError (buffer is full). This is BufferChunkOverflowError (one record is too large) — a different error class.
  • receives a chunk after flush retries are exhausted. No chunk was ever created.

The only way to stop the loop is to set chunk_limit_size in @ERROR larger than the biggest record that will ever arrive. But that you don't have any control on.

To Reproduce

  1. Copy the configuration mentioned below, save the file as fluent.conf, make the necessary directory changes accordingly to our environment.

  2. run the command fluentd -c ./fluent.conf

  3. you will see the infinite loop of the error 2026-08-04 15:40:35 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 11534390 bytes record (nth: 0) is larger than buffer chunk limit size (7340032)

Expected behavior

A record that fails in @ERROR for the same reason it arrived there should be dropped, with a log message saying so. @ERROR is the last-resort path; it should be bounded by construction rather than by the user guessing a large enough chunk_limit_size.

Your Environment

markdown
- Fluentd version: 1.19.3
- Operating system: MacOS
- Kernel version: 25.5.0

Your Configuration

apache
<system>
  log_level debug
  root_dir /Users/tarun/fluentd-error/fluent/unrecovered_error-papa/
  flush_interval 10s
</system>

<source>
  @type tail
  @id new_id
  path /Users/tarun/fluentd-error/fluent/sample-longline4.txt
  tag sample.long
  <parse>
    @type none
  </parse>
</source>


<match sample.**>
  @type stdout
  @id stdout_main
  <buffer>
     @type file
     chunk_limit_size 7
     path /Users/tarun/fluentd-error/fluent/fluent-buffer/
     retry_max_times 5
     retry_type exponential_backoff
  </buffer>
</match>


<label @ERROR>
  <match **>
    @type file
    @id id_error_file
    @log_level debug
    path /Users/tarun/fluentd-error/fluent/label-error/
    <buffer>
       @type file
       retry_timeout 30
       retry_type exponential_backoff
       retry_max_interval 10
       chunk_limit_size 7
       retry_wait 10s
       flush_interval 10s
       path /Users/tarun/fluentd-error/fluent/fluent-error-buffer/
       retry_max_times 5
       overflow_action drop_oldest_chunk
    </buffer>
    <secondary>
      @type file
      path /Users/tarun/fluentd-error/fluent/label-error-secondary/
    </secondary>
  </match>
</label>

Your Error Log

bash
2026-08-04 16:56:34 +0530 [info]: fluent/log.rb:372:: starting fluentd-1.19.3 pid=62385 ruby="4.0.6"
2026-08-04 16:56:34 +0530 [info]: fluent/log.rb:372:: spawn command to main:  cmdline=["/opt/homebrew/Cellar/ruby/4.0.6/bin/ruby", "-Eascii-8bit:ascii-8bit", "/opt/homebrew/lib/ruby/gems/4.0.0/bin/fluentd", "-c", "./fluent.conf", "--under-supervisor"]
2026-08-04 16:56:35 +0530 [info]: #0 fluent/log.rb:372:: init worker0 logger path=nil rotate_age=nil rotate_size=nil
2026-08-04 16:56:35 +0530 [info]: fluent/log.rb:372:: adding match in @ERROR pattern="**" type="file"
2026-08-04 16:56:35 +0530 [warn]: #0 fluent/log.rb:393:: default timekey interval (1d) will be used. To change the output frequency, please modify the timekey value
2026-08-04 16:56:35 +0530 [warn]: #0 [id_error_file] 'flush_interval' is ignored because default 'flush_mode' is not 'interval': 'lazy'
2026-08-04 16:56:35 +0530 [warn]: #0 fluent/log.rb:393:: default timekey interval (1d) will be used because of missing <buffer> section. To change the output frequency, please modify the timekey value
2026-08-04 16:56:35 +0530 [info]: fluent/log.rb:372:: adding match pattern="sample.**" type="stdout"
2026-08-04 16:56:35 +0530 [info]: #0 [stdout_main] Oj isn't installed, fallback to JSON as json parser
2026-08-04 16:56:35 +0530 [info]: fluent/log.rb:372:: adding source type="tail"
2026-08-04 16:56:35 +0530 [warn]: #0 [new_id] 'pos_file PATH' parameter is not set to a 'tail' source.
2026-08-04 16:56:35 +0530 [warn]: #0 [new_id] this parameter is highly recommended to save the position to resume tailing.
2026-08-04 16:56:35 +0530 [debug]: #0 fluent/log.rb:351:: No fluent logger for internal event
2026-08-04 16:56:35 +0530 [info]: #0 fluent/log.rb:372:: starting fluentd worker pid=62390 ppid=62385 worker=0
2026-08-04 16:56:35 +0530 [warn]: #0 [stdout_main] restoring buffer file: path = /Users/tarun/fluentd-error/fluent/fluent-buffer/buffer.b65836ea5c74127fce7fc22e600afc387.log
2026-08-04 16:56:35 +0530 [error]: #0 [stdout_main] found broken chunk file during resume. path="/Users/tarun/fluentd-error/fluent/fluent-buffer/buffer.b65836ea5c74127fce7fc22e600afc387.log" mode=:staged err_msg="staged file chunk is empty"
2026-08-04 16:56:35 +0530 [warn]: #0 [stdout_main] bad chunk is moved to /Users/tarun/fluentd-error/fluent/unrecovered_error-papa/backup/worker0/stdout_main/65836ea5c74127fce7fc22e600afc387.log
2026-08-04 16:56:35 +0530 [info]: #0 [stdout_main] Since a broken chunk file was found, it is possible that other files remaining at the time of resuming were also broken. Here is the list of the files.
2026-08-04 16:56:35 +0530 [debug]: #0 [stdout_main] buffer started instance=1328 stage_size=0 queue_size=0
2026-08-04 16:56:35 +0530 [debug]: #0 [stdout_main] flush_thread actually running
2026-08-04 16:56:35 +0530 [debug]: #0 [stdout_main] enqueue_thread actually running
2026-08-04 16:56:35 +0530 [debug]: #0 [id_error_file] restoring buffer file: path = /Users/tarun/fluentd-error/fluent/fluent-error-buffer/buffer.b65836ea5d46861d84071a445e547f724.log
2026-08-04 16:56:35 +0530 [debug]: #0 [id_error_file] buffer started instance=1304 stage_size=0 queue_size=50332088
2026-08-04 16:56:35 +0530 [debug]: #0 [id_error_file] flush_thread actually running
2026-08-04 16:56:35 +0530 [debug]: #0 [id_error_file] enqueue_thread actually running
2026-08-04 16:56:35 +0530 [debug]: #0 [new_id] tailing paths: target = /Users/tarun/fluentd-error/fluent/sample-longline4.txt | existing = 
2026-08-04 16:56:35 +0530 [info]: #0 [new_id] following tail of /Users/tarun/fluentd-error/fluent/sample-longline4.txt
2026-08-04 16:56:35 +0530 [info]: #0 fluent/log.rb:372:: fluentd worker is now running worker=0
2026-08-04 16:56:42 +0530 [info]: #0 [new_id] detected rotation of /Users/tarun/fluentd-error/fluent/sample-longline4.txt
2026-08-04 16:56:42 +0530 [info]: #0 [new_id] following tail of /Users/tarun/fluentd-error/fluent/sample-longline4.txt
2026-08-04 16:56:43 +0530 [debug]: #0 [stdout_main] Created new chunk chunk_id="65836edf2e5630c57b6d4b670bcb6459" metadata=#<struct Fluent::Plugin::Buffer::Metadata timekey=nil, tag="sample.long", variables=nil, seq=0>
2026-08-04 16:56:43 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291522 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291522 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:43 +0530 [debug]: #0 [id_error_file] Created new chunk chunk_id="65836edf3e248fa93d3e49387458bcc0" metadata=#<struct Fluent::Plugin::Buffer::Metadata timekey=1785781800, tag=nil, variables=nil, seq=0>
2026-08-04 16:56:43 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:43 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 6) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 7) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 8) is larger than buffer chunk limit size (7)" location="/opt/homebrew/lib/ruby/gems/4.0.0/gems/fluentd-1.19.3/lib/fluent/plugin/buffer.rb:462:in 'Fluent::Plugin::Buffer#write'" tag="sample.long"
2026-08-04 16:56:44 +0530 [warn]: #0 fluent/log.rb:393:: send an error event stream to @ERROR: error_class=Fluent::Plugin::Buffer::BufferChunkOverflowError error="a 6291511 bytes record (nth: 0) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 1) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 2) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 3) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 4) is larger than buffer chunk limit size (7), a 6291511 bytes record (nth: 5) is larger than buffer chu