{"record":{"id":"b7af051028ad55c8","repo":"fluent/fluentd","slug":"format-parameter-is-required","errorCode":null,"errorMessage":"'format' parameter is required","messagePattern":"'format' parameter is required","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/compat/formatter.rb","lineNumber":61,"sourceCode":"          Fluent::Plugin.register_formatter(type, Proc.new { ProcWrappedFormatter.new(template) })\n        elsif template.respond_to?(:call)\n          Fluent::Plugin.register_formatter(type, template)\n        else\n          raise ArgumentError, \"Template for formatter must be a Class or callable object\"\n        end\n      end\n\n      def self.lookup(type)\n        # TODO: warn when deprecated to use Plugin.new_formatter(type, parent: plugin)\n        Fluent::Plugin.new_formatter(type)\n      end\n\n      # Keep backward-compatibility\n      def self.create(conf)\n        # TODO: warn when deprecated\n        format = conf['format']\n        if format.nil?\n          raise ConfigError, \"'format' parameter is required\"\n        end\n\n        formatter = lookup(format)\n        if formatter.respond_to?(:configure)\n          formatter.configure(conf)\n        end\n        formatter\n      end\n\n      HandleTagAndTimeMixin = Fluent::Compat::HandleTagAndTimeMixin\n      StructuredFormatMixin = Fluent::Compat::StructuredFormatMixin\n\n      class ProcWrappedFormatter < Fluent::Plugin::ProcWrappedFormatter\n        # TODO: warn when deprecated\n      end\n\n      class OutFileFormatter < Fluent::Plugin::OutFileFormatter\n        # TODO: warn when deprecated","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/compat/formatter.rb#L43-L79","documentation":"Raised as Fluent::ConfigError by the legacy compatibility helper Fluent::Compat::TextFormatter.create(conf), which builds a formatter from a v0.12-style conf. It selects the plugin purely via conf['format']; when that key is nil there is nothing to instantiate and configuration aborts with \"'format' parameter is required\".","triggerScenarios":"TextFormatter.create(conf) where conf only has keys like 'out_format' or '@type'; v0.12 plugin code migrated to v1 where the type now lives in '@type' instead of 'format'; programmatically built conf hashes that forgot the format key.","commonSituations":"Old plugins calling TextFormatter.create on user-supplied config sections; config translations from v0.12 ('format json') to v1 ('@type json'); test drivers passing minimal confs.","solutions":["Set the format key in the conf passed to create: { 'format' => 'json', ... }","Map '@type' to 'format' before calling create when translating v1 configs","Prefer the v1 API: Fluent::Plugin.new_formatter(type).configure(conf) or Fluent::Compat::TextFormatter.lookup(type)"],"exampleFix":"# before\nformatter = Fluent::Compat::TextFormatter.create('output_format' => 'json')\n\n# after\nformatter = Fluent::Compat::TextFormatter.create('format' => 'json')","handlingStrategy":"validation","validationCode":"conf['format'] = conf.delete('@type') if conf['format'].nil? && conf['@type']\nraise 'conf needs a format key' if conf['format'].nil?\nformatter = Fluent::Compat::TextFormatter.create(conf)","typeGuard":null,"tryCatchPattern":"begin\n  Fluent::Compat::TextFormatter.create(conf)\nrescue Fluent::ConfigError => e\n  raise unless e.message.include?(\"'format' parameter is required\")\n  conf = conf.merge('format' => 'json') # sensible default, then retry\n  retry\nend","preventionTips":["Treat 'format' as required in every legacy formatter conf you build","Translate '@type' to 'format' when feeding v1 configs to v0.12-era helpers","Migrate call sites to Fluent::Plugin.new_formatter(type).configure(conf)"],"tags":["fluentd","formatter","config","v012-compat","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}