{"record":{"id":"d6ca9962232a5fe0","repo":"fluent/fluentd","slug":"name-invalid-bool-value-str","errorCode":null,"errorMessage":"#{name}: invalid bool value: #{str}","messagePattern":"#(.+?): invalid bool value: #(.+?)","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/config/types.rb","lineNumber":77,"sourceCode":"    end\n\n    def self.bool_value(str, opts = {}, name = nil)\n      return nil if str.nil?\n\n      case str.to_s\n      when 'true', 'yes'\n        true\n      when 'false', 'no'\n        false\n      when ''\n        true\n      else\n        # Current parser passes comment without actual values, e.g. \"param #foo\".\n        # 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.\n        if str.respond_to?(:start_with?) && str.start_with?('#')\n          true\n        elsif opts[:strict]\n          raise Fluent::ConfigError, \"#{name}: invalid bool value: #{str}\"\n        else\n          nil\n        end\n      end\n    end\n\n    def self.regexp_value(str, opts = {}, name = nil)\n      return nil unless str\n\n      return Regexp.compile(str) unless str.start_with?(\"/\")\n      right_slash_position = str.rindex(\"/\")\n      if right_slash_position < str.size - 3\n        raise Fluent::ConfigError, \"invalid regexp: missing right slash: #{str}\"\n      end\n      options = str[(right_slash_position + 1)..-1]\n      option = 0\n      option |= Regexp::IGNORECASE if options.include?(\"i\")\n      option |= Regexp::MULTILINE if options.include?(\"m\")","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/config/types.rb#L59-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before (with <system> strict_config_value true)\n<match demo.**>\n  @type http\n  verify_tls 1\n</match>\n\n# after\n<match demo.**>\n  @type http\n  verify_tls true\n</match>","handlingStrategy":"validation","validationCode":"v = raw_value.to_s\nok = v.empty? || %w[true yes false no].include?(v) || v.start_with?('#')\nraise ArgumentError, \"not a fluentd bool: #{v.inspect}\" unless ok","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["fluentd","config","boolean","type-conversion","strict-mode"],"backgroundTag":"invalid-config-value","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}