{"record":{"id":"8aa90c14c97d7cb1","repo":"fluent/fluentd","slug":"invalid-created-at","errorCode":null,"errorMessage":"invalid created_at","messagePattern":"invalid created_at","errorType":"exception","errorClass":"FileChunkError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/buffer/file_chunk.rb","lineNumber":224,"sourceCode":"\n        # 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","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/buffer/file_chunk.rb#L206-L242","documentation":"restore_metadata requires the :c (created_at) field to be a positive integer timestamp; data[:c].to_i > 0 must hold or FileChunkError 'invalid created_at' is raised. A metadata Hash that parses but carries a zero/missing/negative created_at is considered broken.","triggerScenarios":"A restored Hash from the old-format fallback where :c is absent ({} gives nil.to_i == 0) or was serialized as 0/garbage; meta files touched by external tooling that rewrote timestamps.","commonSituations":"Same corruption class as the other metadata validation failures: power failure, disk full, partial writes, version-mismatched buffer directories.","solutions":["Let the resume path quarantine the chunk (handle_broken_files) and note the possible data loss in logs","Restore from backup if needed","Harden the environment: graceful restarts, disk space alerts, avoiding shared buffer dirs across versions","Verify system clock sanity (NTP) — wild timestamps in tooling that rewrote metas can also produce this"],"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 created_at\" unless data.is_a?(Hash) && data[:c].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 \"quarantining #{path}: #{e.message}\"; File.rename(path, \"#{path}.broken\")\nend","preventionTips":["Avoid hard power-off on buffer hosts (use watchdogs that send SIGTERM first)","Verify system time via NTP before fluend starts","Don't hand-edit .meta files","Monitor for 'broken chunk' log lines and alert on them"],"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"}