{"record":{"id":"0b07433843952617","repo":"fluent/fluentd","slug":"format-should-be-regexp-need-in-key-fo","errorCode":null,"errorMessage":"format should be Regexp, need //, in #{key}: '#{format}'","messagePattern":"format should be Regexp, need //, in #(.+?): '#(.+?)'","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin/parser_multiline.rb","lineNumber":147,"sourceCode":"      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\n\n      def check_format_regexp(format, key)\n        if format[0] == '/' && format[-1] == '/'\n          begin\n            Regexp.new(format[1..-2], Regexp::MULTILINE)\n          rescue => e\n            raise Fluent::ConfigError, \"Invalid regexp in #{key}: #{e}\"\n          end\n        else\n          raise Fluent::ConfigError, \"format should be Regexp, need //, in #{key}: '#{format}'\"\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":129,"sourceCodeEnd":153,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin/parser_multiline.rb#L129-L153","documentation":"MultilineParser#check_format_regexp (lib/fluent/plugin/parser_multiline.rb:147) requires every formatN and format_firstline value to be a Ruby regexp literal wrapped in slashes; anything else raises Fluent::ConfigError. The parser strips the first and last characters and compiles the middle, so an unslashed pattern (which may even be valid text) is treated as malformed input rather than a regex.","triggerScenarios":"format1 ^\\d{4}- (pattern without surrounding '/'); format_firstline ^\\[\\d{4}\\]; quoting a plain string like format1 '[INFO]'; trailing whitespace after the closing slash leaving the last char as a space.","commonSituations":"Users pasting raw patterns from docs into fluent.conf; transitioning from v0 formats where some directives accepted bare strings; configs where the trailing '/' was dropped during YAML-to-v1 conversion or templating.","solutions":["Wrap each formatN / format_firstline value in '/.../', e.g. format1 /^\\\\d{4}-/.","Trim stray whitespace after the closing slash.","Run fluentd --dry-run to verify before restart."],"exampleFix":"# before\nformat1 ^\\d{4}-\\d{2}-\\d{2}\n# after\nformat1 /^\\d{4}-\\d{2}-\\d{2}/","handlingStrategy":"validation","validationCode":"conf.each do |k, v|\n  next unless k.start_with?('format') || k == 'format_firstline'\n  abort \"#{k} lacks // delimiters\" unless v.start_with?('/') && v.end_with?('/')\nend","typeGuard":"def slashed_regexp_literal?(s)\n  s.is_a?(String) && s.length >= 2 && s.start_with?('/') && s.end_with?('/')\nend","tryCatchPattern":null,"preventionTips":["Always author format values as '/.../' literals.","Trim whitespace around the value so the final char really is '/'.","Include delimiter checks in config linters."],"tags":["fluentd","multiline-parser","config-error","regex-syntax"],"backgroundTag":"invalid-regex-in-config","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}