fluent/fluentd · error · Fluent::ConfigError
time_type is :mixed but time_format and time_format_fallback
Error message
time_type is :mixed but time_format and time_format_fallbacks is empty.
What it means
Fluent::ConfigError raised in TimeParameters#configure (lib/fluent/time.rb:177) when time_type is set to :mixed but neither time_format nor time_format_fallbacks provides any format. The :mixed mode works by trying a primary format and then fallback parsers (e.g. unixtime, %iso8601), so with no formats configured there is nothing to parse with and startup fails.
Source
Thrown at lib/fluent/time.rb:177
conf['localtime'] = Fluent::Config.bool_value(conf['localtime'])
elsif conf.has_key?('utc')
conf['localtime'] = !(Fluent::Config.bool_value(conf['utc']))
# Specifying "localtime false" means using UTC in TimeFormatter
# And specifying "utc" is different from specifying "timezone +0000"(it's not always UTC).
# There are difference between "Z" and "+0000" in timezone formatting.
# TODO: add kwargs to TimeFormatter to specify "using localtime", "using UTC" or "using specified timezone" in more explicit way
end
end
super
if conf.has_key?('localtime') && conf.has_key?('utc') && !(@localtime ^ @utc)
raise Fluent::ConfigError, "both of utc and localtime are specified, use only one of them"
end
if conf.has_key?('time_type') and @time_type == :mixed
if @time_format.nil? and @time_format_fallbacks.empty?
raise Fluent::ConfigError, "time_type is :mixed but time_format and time_format_fallbacks is empty."
end
end
Fluent::Timezone.validate!(@timezone) if @timezone
end
end
module Parser
def self.included(mod)
mod.include TimeParameters
end
def time_parser_create(type: @time_type, format: @time_format, timezone: @timezone, force_localtime: false)
return MixedTimeParser.new(type, format, @localtime, timezone, @utc, force_localtime, @time_format_fallbacks) if type == :mixed
return NumericTimeParser.new(type) if type != :string
return TimeParser.new(format, true, nil) if force_localtime
localtime = @localtime && (timezone.nil? && !@utc)View on GitHub (pinned to dd45c6e18d)
Solutions
- Add time_format_fallbacks listing the formats to try, e.g. time_type mixed + time_format_fallbacks %iso8601, unixtime
- Or specify a primary time_format plus fallbacks: time_format %iso8601 and time_type mixed with time_format_fallbacks unixtime
- If you only ever have one timestamp shape, drop time_type mixed entirely — the default parser with a single time_format is simpler
Example fix
# before <parse> @type regexp time_key time time_type mixed </parse> # after <parse> @type regexp time_key time time_type mixed time_format %iso8601 time_format_fallbacks unixtime </parse>
Defensive patterns
Strategy: validation
Validate before calling
time_type = 'mixed' time_format = nil time_format_fallbacks = [] if time_type == :mixed && time_format.nil? && time_format_fallbacks.empty? raise 'time_type mixed requires time_format and/or time_format_fallbacks' end
Prevention
- Treat time_type mixed as 'format list mode': always write at least one format next to it
- Use the two canonical shapes from the docs: time_format + fallbacks, or fallbacks alone
- Dry-run configs in CI
When it happens
Trigger: A parser/formatter section with time_type mixed and no time_format / time_format_fallbacks lines; also when time_format is present but empty. Valid usage is either 'time_format + time_type mixed (+ optional fallbacks)' or 'time_type mixed + time_format_fallbacks' listing at least one format.
Common situations: Enabling time_type mixed to accept both epoch seconds and ISO8601 but forgetting the fallbacks line; renaming time_format_fallbacks to a wrong key so it is silently ignored and only time_type remains; upgrading a config where time_type mixed was added experimentally.
Related errors
- specifying timezone requires time format
- invalid time format: value = #{value}, even though fallbacks
- out_secondary_file: basename or directory has an incompatibl
- invalid number of workers (must be 1 or unspecified) with --
- <system> is duplicated. <system> should be only one
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/327b08044762066b.
Report an issue: GitHub.