fluent/fluentd · error · Fluent::ConfigError
e.message
Error message
e.message
What it means
in_exec's optional encoding param is validated by Encoding.find(encoding); Ruby raises ArgumentError for any name that does not map to a registered encoding (e.g. 'unknown encoding name - utf88'), and validate_encoding re-raises that message verbatim as Fluent::ConfigError. The value becomes the external encoding of the spawned command's stdin/stdout pipes, so it must be a real Ruby encoding name (UTF-8, EUC-JP, Windows-31J, ...).
Source
Thrown at lib/fluent/plugin/in_exec.rb:77
if subsection.has_key?('time_format')
subsection['time_type'] ||= 'string'
end
end
end
super
if !@tag && (!@extract_config || !@extract_config.tag_key)
raise Fluent::ConfigError, "'tag' or 'tag_key' option is required on exec input"
end
validate_encoding(@encoding) if @encoding
@parser = parser_create
end
def validate_encoding(encoding)
Encoding.find(encoding)
rescue ArgumentError => e
raise Fluent::ConfigError, e.message
end
def multi_workers_ready?
true
end
def start
super
options = { mode: [@connect_mode] }
options[:external_encoding] = @encoding if @encoding
if @run_interval
child_process_execute(:exec_input, @command, interval: @run_interval, wait_timeout: @command_timeout, **options, &method(:run))
else
child_process_execute(:exec_input, @command, immediate: true, wait_timeout: @command_timeout, **options, &method(:run))
end
endView on GitHub (pinned to dd45c6e18d)
Solutions
- Use a name Ruby's Encoding.find accepts: ruby -e 'puts Encoding.list.map(&:to_s)' to list valid ones.
- For locale strings, strip to the encoding part only (UTF-8 out of en_US.UTF-8).
- Run fluentd --dry-run to fail fast at config load rather than at runtime.
Example fix
# before <source> @type exec command /opt/scripts/dump.sh encoding en_US.UTF-8 </source> # after <source> @type exec command /opt/scripts/dump.sh encoding UTF-8 </source>
Defensive patterns
Strategy: validation
Validate before calling
# preflight: validate the encoding name exactly as in_exec will
Encoding.find('UTF-8') # raises ArgumentError for invalid names
# programmatic check for a config value:
begin
Encoding.find(candidate_encoding)
rescue ArgumentError
abort "invalid encoding for in_exec: #{candidate_encoding}"
end Type guard
->(name) { name.is_a?(String) && (Encoding.find(name) rescue nil) } Try / catch
begin
Fluent::Plugin.new_input('exec').configure(conf)
rescue Fluent::ConfigError => e
abort "exec input config rejected: #{e.message}" # e.g. 'unknown encoding name - en_US.UTF-8'
end Prevention
- Pick encoding names from ruby -e 'puts Encoding.list.map(&:to_s)'.
- Do not paste locale strings (en_US.UTF-8) into encoding; use the encoding part only.
- Dry-run the config to fail at load time instead of during pipeline start.
When it happens
Trigger: Setting encoding to a locale-style string ('en_US.UTF-8'), a typo ('utf8x', 'UTF--8'), or an unregistered alias in an in_exec source; the ArgumentError message from Encoding.find becomes the ConfigError text shown.
Common situations: Copy-pasting locale environment values into encoding; assuming iconv/codepage names ('cp1252' works but 'windows-1252x' style typos do not); command output in a legacy Japanese encoding configured with a wrong alias.
Related errors
- 'tag' or 'tag_key' option is required on exec input
- Duplicate key in <or>: #{e.key}
- `renew_record` must be true to use `keep_keys`
- empty value is specified in fields parameter
- unknown_key
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/5c0d15d7daa4e580.
Report an issue: GitHub.