{"record":{"id":"72fe528a7c77f946","repo":"fluent/fluentd","slug":"jump-of-format-index-found-format-i-1-is-miss","errorCode":null,"errorMessage":"Jump of format index found. format#{i - 1} is missing.","messagePattern":"Jump of format index found\\. format#(.+?) is missing\\.","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/parser_multiline.rb","lineNumber":119,"sourceCode":"\n      def has_firstline?\n        !!@format_firstline\n      end\n\n      def firstline?(text)\n        @firstline_regex.match?(text)\n      end\n\n      private\n\n      def parse_formats(conf)\n        check_format_range(conf)\n\n        prev_format = nil\n        (1..FORMAT_MAX_NUM).map { |i|\n          format = conf[\"format#{i}\"]\n          if (i > 1) && prev_format.nil? && !format.nil?\n            raise Fluent::ConfigError, \"Jump of format index found. format#{i - 1} is missing.\"\n          end\n          prev_format = format\n          next if format.nil?\n\n          check_format_regexp(format, \"format#{i}\")\n          format\n        }\n      end\n\n      def check_format_range(conf)\n        invalid_formats = conf.keys.select { |k|\n          m = k.match(/^format(\\d+)$/)\n          m ? !((1..FORMAT_MAX_NUM).include?(m[1].to_i)) : false\n        }\n        unless invalid_formats.empty?\n          raise Fluent::ConfigError, \"Invalid formatN found. N should be 1 - #{FORMAT_MAX_NUM}: \" + invalid_formats.join(\",\")\n        end\n      end","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/parser_multiline.rb#L101-L137","documentation":"MultilineParser#parse_formats (lib/fluent/plugin/parser_multiline.rb:119) enforces that formatN keys are contiguous: it walks format1..format20 and raises Fluent::ConfigError when some format{i} exists while format{i-1} is absent. Multiline parsing concatenates the regexes in order, so a gap would silently change the assembled expression. Purely a configuration-shape error, raised at configure time.","triggerScenarios":"Config with format1 and format3 but no format2; deleting an intermediate formatN line during cleanup; renumbering mistakes after copy-pasting additional segments (e.g. format1, format2, format4).","commonSituations":"Editing Java stack-trace multiline configs and removing a middle section; hand-merging examples from docs where numbering differs; merging config snippets from different sources with inconsistent N.","solutions":["Renumber the formatN keys to be contiguous starting at format1 (1,2,3,...).","If a segment is no longer needed, fold its pattern into the adjacent formatN rather than leaving a hole.","Run fluentd --dry-run to catch it before restart."],"exampleFix":"# before\nformat1 /(?<head>^\\w+)/\nformat3 /(?<tail>\\s+.*)/\n# after\nformat1 /(?<head>^\\w+)/\nformat2 /(?<tail>\\s+.*)/","handlingStrategy":"validation","validationCode":"# ensure contiguous numbering\nns = conf.keys.map { |k| k[/\\Aformat(\\d+)\\z/, 1]&.to_i }.compact.sort\nns.each_with_index do |n, i|\n  abort \"gap before format#{n}\" unless n == i + 1\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Number format keys 1,2,3,... without gaps by construction.","When deleting a middle segment, renumber the remainder in the same commit.","Dry-run after multiline config edits."],"tags":["fluentd","multiline-parser","config-error","format-index"],"backgroundTag":"config-parameter-validation","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}