{"record":{"id":"baafe6ae2ea20e57","repo":"fluent/fluentd","slug":"can-t-create-buffer-metadata-for-path-stop-cre","errorCode":null,"errorMessage":"can't create buffer metadata for #{path}. Stop creating buffer files: error = #{e}","messagePattern":"can't create buffer metadata for #(.+?)\\. Stop creating buffer files: error = #(.+?)","errorType":"exception","errorClass":"BufferOverflowError","httpStatus":null,"severity":"critical","filePath":"lib/fluent/plugin/buffer/file_chunk.rb","lineNumber":313,"sourceCode":"          begin\n            @meta = File.open(@meta_path, 'wb', perm)\n            @meta.set_encoding(Encoding::ASCII_8BIT)\n            @meta.sync = true\n            @meta.binmode\n            write_metadata(update: false)\n          rescue => e\n            # This case is easier than enqueued!. Just removing pre-create buffer file\n            @chunk.close rescue nil\n            File.unlink(@path) rescue nil\n\n            if @meta\n              # ensure to unlink when #write_metadata fails\n              @meta.close rescue nil\n              File.unlink(@meta_path) rescue nil\n            end\n\n            # Same as @chunk case. See above\n            raise BufferOverflowError, \"can't create buffer metadata for #{path}. Stop creating buffer files: error = #{e}\"\n          end\n\n          @state = :unstaged\n          @bytesize = 0\n          @commit_position = @chunk.pos # must be 0\n          @adding_bytes = 0\n          @adding_size = 0\n        end\n\n        def load_existing_staged_chunk(path)\n          @path = path\n          @meta_path = @path + '.meta'\n\n          @meta = nil\n          # staging buffer chunk without metadata is classic buffer chunk file\n          # and it should be enqueued immediately\n          if File.exist?(@meta_path)\n            raise FileChunkError, \"staged file chunk is empty\" if File.size(@path).zero?","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/buffer/file_chunk.rb#L295-L331","documentation":"In create_new_chunk, after the data file is opened successfully, the companion .meta file is opened and initial metadata written; any failure there triggers cleanup (chunk file closed and unlinked, meta unlinked) and re-raise as BufferOverflowError with this message. As with the data-file case, the intended trigger is FD exhaustion, but any meta write error (disk full, permission) surfaces here too. Cleanup means no orphan half-chunk remains.","triggerScenarios":"File.open on path+'.meta' or write_metadata fails: EMFILE when FDs are exhausted, ENOSPC when the disk fills between creating the chunk file and its meta, EACCES/EROFS on read-only or mis-permitted buffer directories.","commonSituations":"Disk filling rapidly under heavy buffering (meta writes are small but frequent); FD pressure from many staged chunks; container mounts that became read-only; dir_permission config not matching actual directory mode.","solutions":["Read the wrapped 'error = Errno::...' to classify: EMFILE → raise ulimit/LimitNOFILE and reduce concurrent chunks; ENOSPC → free space, cap total_limit_size, move buffer to a bigger volume; EACCES/EROFS → fix mount/permissions on the buffer directory","Because cleanup unlinks the half-created files, no manual file removal is needed — after fixing the cause, buffered output recovers on its own","Monitor buffer volume free space and open-FD count with alerts","Consider memory buffer for small, non-critical outputs to reduce file pressure"],"exampleFix":"# /etc/security/limits.conf or systemd unit\n[Service]\nLimitNOFILE=65536\n\n# fluent.conf: keep buffer within real disk capacity\n<buffer>\n  @type file\n  total_limit_size 4GB   # sized below the volume's free space\n</buffer>","handlingStrategy":"retry","validationCode":"free = Sys::Filesystem.stat(buffer_dir).bytes_free\nabort 'buffer disk nearly full' if free < total_limit_size\nProcess.getrlimit(:NOFILE).tap { |(soft,)| abort 'raise NOFILE' if soft < 65_536 }","typeGuard":null,"tryCatchPattern":"begin\n  buffer.write(metadata => data)\nrescue Fluent::Plugin::Buffer::BufferOverflowError => e\n  if e.message.include?(\"can't create buffer metadata\")\n    log.warn 'meta creation failed (fd/disk/perm); retrying after backoff'\n    sleep 2 and retry\n  else\n    raise\n  end\nend","preventionTips":["Disk-space alerts on the buffer volume at 80%","Ensure dir permissions match dir_permission config","Graceful degradation: cap total_limit_size below volume size","Raise fd limits; the meta+data pair doubles open files per staged chunk"],"tags":["fluentd","buffer","file-chunk","meta-file","disk-full","fd-limit"],"backgroundTag":"too-many-open-files","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}