fluent/fluentd · error · Fluent::ConfigError
#{name}: invalid bool value: #{str}
Error message
#{name}: invalid bool value: #{str} What it means
Raised when a parameter declared with the :bool config type receives a string fluentd does not recognize as a boolean while strict value parsing is on. Recognized values are only 'true'/'yes' (and the empty string, treated as true), 'false'/'no', and a value starting with '#' (a comment-only leftover of the old parser, tolerated as true). With strict mode (the --strict-config-value CLI flag or <system> strict_config_value true), anything else raises Fluent::ConfigError instead of silently becoming nil. Matching is case-sensitive, so 'TRUE' or 'On' are rejected.
Source
Thrown at lib/fluent/config/types.rb:77
end
def self.bool_value(str, opts = {}, name = nil)
return nil if str.nil?
case str.to_s
when 'true', 'yes'
true
when 'false', 'no'
false
when ''
true
else
# Current parser passes comment without actual values, e.g. "param #foo".
# parser should pass empty string in this case but changing behaviour may break existing environment so keep parser behaviour. Just ignore comment value in boolean handling for now.
if str.respond_to?(:start_with?) && str.start_with?('#')
true
elsif opts[:strict]
raise Fluent::ConfigError, "#{name}: invalid bool value: #{str}"
else
nil
end
end
end
def self.regexp_value(str, opts = {}, name = nil)
return nil unless str
return Regexp.compile(str) unless str.start_with?("/")
right_slash_position = str.rindex("/")
if right_slash_position < str.size - 3
raise Fluent::ConfigError, "invalid regexp: missing right slash: #{str}"
end
options = str[(right_slash_position + 1)..-1]
option = 0
option |= Regexp::IGNORECASE if options.include?("i")
option |= Regexp::MULTILINE if options.include?("m")View on GitHub (pinned to dd45c6e18d)
Solutions
- Change the value to a literal true/false/yes/no (lowercase)
- If the value is only a comment (e.g. 'param #todo'), move the comment to its own line so the value is empty or a real boolean
- Remove --strict-config-value / <system> strict_config_value true if a legacy config cannot be fixed yet (unrecognized values then become nil, not an error)
- For programmatic use, call Fluent::Config.bool_value(val) without strict: true when you want lenient coercion
Example fix
# before (with <system> strict_config_value true) <match demo.**> @type http verify_tls 1 </match> # after <match demo.**> @type http verify_tls true </match>
Defensive patterns
Strategy: validation
Validate before calling
v = raw_value.to_s
ok = v.empty? || %w[true yes false no].include?(v) || v.start_with?('#')
raise ArgumentError, "not a fluentd bool: #{v.inspect}" unless ok Prevention
- Use only lowercase true/false/yes/no literals in configs
- Run CI config checks with --strict-config-value --dry-run to surface bad values before deploy
- Never write booleans as 1/0 or on/off in fluentd configs
When it happens
Trigger: config_param :flag, :bool (or Config.bool_value(str, strict: true)) with a value like '1', '0', 'on', 'off', 'enable', 'TRUE', or a stray character after yes/no. Only exact lowercase 'true','yes','false','no' (or empty string, or a leading '#') pass.
Common situations: Porting configs from tools that use 1/0 or on/off for booleans; uppercase boolean literals; enabling --strict-config-value in CI to catch typos; values injected through ENV expansion picking up stray whitespace or characters.
Related errors
- #{name}: #{e.message}
- invalid regexp: missing right slash: #{str}
- Unknown #{@kind} plugin '#{type}'. Run 'gem search -rd fluen
- Missing '@type' parameter on <#{e.name}> directive
- 'format' parameter is required
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/d6ca9962232a5fe0.
Report an issue: GitHub.