fluent/fluentd · error · ConfigError
valid options are #{list.join(',')} but got #{val}
Error message
valid options are #{list.join(',')} but got #{val} What it means
For enum parameters (config_param :x, :enum, list: [:a, :b]), enum_value converts the value to a Symbol and checks membership in the plugin-provided :list; a miss raises ConfigError with the exact allowed set in the message. The check runs only after verifying the plugin itself supplied a Symbol array, otherwise the author-facing 'Plugin BUG' error fires first. Comparison is exact and case-sensitive after to_sym, so 'JSON' will not match :json.
Source
Thrown at lib/fluent/config/types.rb:128
def self.symbol_value(val, opts = {}, name = nil)
return nil if val.nil? || val.empty?
val.delete_prefix(":").to_sym
end
SYMBOL_TYPE = Proc.new { |val, opts = {}, name = nil|
Config.symbol_value(val, opts, name)
}
def self.enum_value(val, opts = {}, name = nil)
return nil if val.nil?
s = val.to_sym
list = opts[:list]
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
elseView on GitHub (pinned to dd45c6e18d)
Solutions
- Use one of the values printed in the error message (they are the plugin's declared list)
- Fix typos and casing — the value must match a listed symbol exactly
- Check the plugin's docs/config_param declaration for the current allowed set; plugin versions sometimes narrow the list
- If you own the plugin, add the value to the :list or switch the param to :string when an open-ended value is legitimate
Example fix
# before
# config_param :format, :enum, list: [:out_file, :json, :ltsv]
<match demo.**>
@type file
<format>
@type ltsvv
</format>
</match>
# after
<match demo.**>
@type file
<format>
@type ltsv
</format>
</match> Defensive patterns
Strategy: validation
Validate before calling
allowed = %i[text json ltsv] # from the plugin's :list
unless allowed.include?(raw_value.to_sym)
raise ArgumentError, "#{raw_value.inspect} not in #{allowed.join(',')}"
end Prevention
- Copy allowed values from the plugin's config_param :list, not from memory
- Use a config linter/dry-run so enum typos fail in CI
- Pin plugin versions so enum lists do not change under you
When it happens
Trigger: config_param :format, :enum, list: [:text, :ltsv] with 'format json' (json not in list), a typo like 'jsonn', wrong casing, or an ENV-expanded value that yields a string outside the declared list.
Common situations: Copy-pasting a value valid for a different plugin (e.g. 'json' where the plugin only accepts :msgpack/:text); typos in long option names; case-mismatched values; upgrading a plugin whose enum list dropped an old value.
Related errors
- Unknown #{@kind} plugin '#{type}'. Run 'gem search -rd fluen
- Missing '@type' parameter on <#{e.name}> directive
- 'format' parameter is required
- both of utc and localtime are specified, use only one of the
- this plugin '#{self.class}' cannot handle arguments for <buf
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/409282d51d688d02.
Report an issue: GitHub.