{"record":{"id":"37851a59298a53ce","repo":"fluent/fluentd","slug":"invalid-modified-at","errorCode":null,"errorMessage":"invalid modified_at","messagePattern":"invalid modified_at","errorType":"exception","errorClass":"FileChunkError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/buffer/file_chunk.rb","lineNumber":225,"sourceCode":"        # used only for queued v0.12 buffer path or broken files\n        def self.unique_id_from_path(path)\n          if /\\.(b|q)([0-9a-f]+)\\.[^\\/]*\\Z/n =~ path # //n switch means explicit 'ASCII-8BIT' pattern\n            return $2.scan(/../).map{|x| x.to_i(16) }.pack('C*')\n          end\n          nil\n        end\n\n        def restore_metadata(bindata)\n          data = restore_metadata_with_new_format(bindata)\n\n          unless data\n            # old type of restore\n            data = Fluent::MessagePackFactory.msgpack_unpacker(symbolize_keys: true).feed(bindata).read rescue {}\n          end\n          raise FileChunkError, \"invalid meta data\" if data.nil? || !data.is_a?(Hash)\n          raise FileChunkError, \"invalid unique_id\" unless data[:id]\n          raise FileChunkError, \"invalid created_at\" unless data[:c].to_i > 0\n          raise FileChunkError, \"invalid modified_at\" unless data[:m].to_i > 0\n\n          now = Fluent::Clock.real_now\n\n          @unique_id = data[:id]\n          @size = data[:s] || 0\n          @created_at = data[:c]\n          @modified_at = data[:m]\n\n          @metadata.timekey = data[:timekey]\n          @metadata.tag = data[:tag]\n          @metadata.variables = data[:variables]\n          @metadata.seq = data[:seq] || 0\n        end\n\n        def restore_metadata_partially(chunk)\n          @unique_id = self.class.unique_id_from_path(chunk.path) || @unique_id\n          @size = 0\n          @created_at = chunk.ctime.to_i # birthtime isn't supported on Windows (and Travis?)","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/buffer/file_chunk.rb#L207-L243","documentation":"The last of restore_metadata's field checks: :m (modified_at) must satisfy data[:m].to_i > 0 or FileChunkError 'invalid modified_at' is raised. modified_at drives queue ordering (chunks are sorted by it on resume), so an invalid value would break flush ordering and is rejected instead.","triggerScenarios":"Same as the sibling checks — an empty/garbage fallback Hash ({}) or a meta file whose :m is missing, zero, or non-numeric; typically after a crash mid-write of the .meta file.","commonSituations":"Power failure or SIGKILL during buffered output; truncated .meta after disk-full; buffer directory copied/restored inconsistently.","solutions":["Rely on fluentd's automatic handling: the broken chunk is logged, moved aside/deleted at resume, remaining chunks are listed in the log for audit","Restore buffer dir from snapshot if the events must not be lost","Prevent: graceful shutdown, disk monitoring, flush_at_shutdown awareness","Inspect sibling chunks listed in the follow-up log line for related corruption"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"Dir.glob('buffer/**/*.meta').each do |m|\n  data = Fluent::MessagePackFactory.msgpack_unpacker(symbolize_keys: true)\n                .feed(File.binread(m)).read rescue {}\n  warn \"#{m}: invalid modified_at\" unless data.is_a?(Hash) && data[:m].to_i > 0\nend","typeGuard":null,"tryCatchPattern":"begin\n  Fluent::Plugin::Buffer::FileChunk.new(metadata, path, :staged)\nrescue Fluent::Plugin::Buffer::FileChunkError => e\n  log.error \"dropping unrestoreable chunk #{path}: #{e.message}\"\n  File.rename(path, \"#{path}.broken\") rescue nil\nend","preventionTips":["SIGTERM-based orchestration (systemd/k8s graceful termination periods longer than flush time)","Disk space monitoring on the buffer volume","Alert on resume-time 'broken' warnings in logs","Keep backups of buffer dirs for replay-critical pipelines"],"tags":["fluentd","buffer","file-chunk","corruption","resume","timestamp"],"backgroundTag":"corrupt-buffer-metadata","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}