fluent/fluentd · error · ConfigError

#{name}: #{e.message}

Error message

#{name}: #{e.message}

What it means

Integer parameters parsed in strict mode (enabled by --strict-config-value or <system> strict_config_value true, applied via section.rb merging strict: true into the type opts) go through Kernel#Integer; an ArgumentError/TypeError is re-raised as Fluent::ConfigError prefixed with the parameter name. Without strict mode the value is coerced with to_i, which silently returns 0 for garbage, so this error specifically signals strict parsing is catching a malformed integer. Kernel#Integer accepts leading signs and 0x/0b/0o prefixes but not units, commas, or trailing characters.

Source

Thrown at lib/fluent/config/types.rb:144

      raise "Plugin BUG: config type 'enum' requires :list of symbols" unless list.is_a?(Array) && list.all?(Symbol)
      unless list.include?(s)
        raise ConfigError, "valid options are #{list.join(',')} but got #{val}"
      end
      s
    end

    ENUM_TYPE = Proc.new { |val, opts = {}, name = nil|
      Config.enum_value(val, opts, name)
    }

    INTEGER_TYPE = Proc.new { |val, opts = {}, name = nil|
      if val.nil?
        nil
      elsif opts[:strict]
        begin
          Integer(val)
        rescue ArgumentError, TypeError => e
          raise ConfigError, "#{name}: #{e.message}"
        end
      else
        val.to_i
      end
    }

    FLOAT_TYPE = Proc.new { |val, opts = {}, name = nil|
      if val.nil?
        nil
      elsif opts[:strict]
        begin
          Float(val)
        rescue ArgumentError, TypeError => e
          raise ConfigError, "#{name}: #{e.message}"
        end
      else
        val.to_f
      end

View on GitHub (pinned to dd45c6e18d)

Solutions

  1. Supply a plain decimal integer, optionally signed (e.g. 24224, -1)
  2. Use the :size type for values with k/m/g/t units and the :time type for durations
  3. Remove quotes, commas, units, and trailing characters from the value
  4. If the value comes from an ENV variable, print/verify the expansion before the run

Example fix

# before (strict_config_value true)
<source>
  @type forward
  port 24224,
</source>

# after
<source>
  @type forward
  port 24224
</source>
Defensive patterns

Strategy: validation

Validate before calling

v = raw_value
Integer(v) # raises ArgumentError now, before fluentd's configure does
# if units are involved use the :size type instead of :integer

Type guard

def integer_config?(v) = v.is_a?(Integer) || (v.is_a?(String) && v.match?(/\A[+-]?\d+\z/))

Try / catch

begin
  Fluent::Config.integer_value(raw, { strict: true }, 'port')
rescue Fluent::ConfigError => e
  raise ConfigInvalid, "port setting invalid: #{e.message}"
end

Prevention

When it happens

Trigger: config_param :port, :integer with 'port 24224abc', 'port http', 'port 1,000', or 'port 10k' while strict mode is on; ENV placeholders expanding to non-numeric strings; quoted numbers with stray whitespace.

Common situations: Enabling strict config validation in CI or production hardening; copy-pasting sizes with units (1k, 1M) into an :integer param instead of :size; locale-style thousands separators; values that used to coerce to 0 silently now failing after enabling strict_config_value.

Related errors


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