fluent/fluentd · error · Fluent::ConfigError

#{i}th element of sample, #{e}, is not a hash

Error message

#{i}th element of sample, #{e}, is not a hash

What it means

Error "#{i}th element of sample, #{e}, is not a hash" thrown in fluent/fluentd.

Source

Thrown at lib/fluent/plugin/in_sample.rb:57

    desc "If specified, each generated event has an auto-incremented key field."
    config_param :auto_increment_key, :string, default: nil
    desc "The boolean to suspend-and-resume incremental value after restart"
    config_param :suspend, :bool, default: false,deprecated: 'This parameters is ignored'
    desc "Reuse the sample data to reduce the load when sending large amounts of data. You can enable it if filter does not do destructive change"
    config_param :reuse_record, :bool, default: false
    desc "The sample data to be generated. An array of JSON hashes or a single JSON hash."
    config_param :sample, alias: :dummy, default: [{"message" => "sample"}] do |val|
      begin
        parsed = JSON.parse(val, Fluent::DEFAULT_JSON_PARSE_OPTIONS)
      rescue JSON::ParserError => ex
        # Fluent::ConfigParseError, "got incomplete JSON" will be raised
        # at literal_parser.rb with --use-v1-config, but I had to
        # take care at here for the case of --use-v0-config.
        raise Fluent::ConfigError, "#{ex.class}: #{ex.message}"
      end
      sample = parsed.is_a?(Array) ? parsed : [parsed]
      sample.each_with_index do |e, i|
        raise Fluent::ConfigError, "#{i}th element of sample, #{e}, is not a hash" unless e.is_a?(Hash)
      end
      sample
    end

    def initialize
      super
      @storage = nil
    end

    def configure(conf)
      super
      @sample_index = 0
      config = conf.elements.find{|e| e.name == 'storage' }
      @storage = storage_create(usage: 'suspend', conf: config, default_type: DEFAULT_STORAGE_TYPE)
    end

    def multi_workers_ready?
      true

View on GitHub (pinned to dd45c6e18d)

When it happens

Trigger: Thrown at lib/fluent/plugin/in_sample.rb:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21). Data as JSON: /api/errors/8905206868eeee81. Report an issue: GitHub.