fluent/fluentd · error · Fluent::ConfigError
missing array index in '[]'. Invalid syntax: #{param}
Error message
missing array index in '[]'. Invalid syntax: #{param} What it means
Fluent::ConfigError from Fluent::RecordAccessor's parse_dot_array_op. Inside dot notation an array index must be an integer between brackets; when the bracket content is empty (index_value == ']'), i.e. '[]', the parser raises because no index was supplied.
Source
Thrown at lib/fluent/plugin_helper/record_accessor.rb:142
end
}
end
def self.parse_dot_array_op(key, param)
start = key.index('[')
result = if start.zero?
[]
else
[key[0..start - 1]]
end
key = key[start + 1..-1]
in_bracket = true
until key.empty?
if in_bracket
if i = key.index(']')
index_value = key[0..i - 1]
raise Fluent::ConfigError, "missing array index in '[]'. Invalid syntax: #{param}" if index_value == ']'
result << Integer(index_value)
key = key[i + 1..-1]
in_bracket = false
else
raise Fluent::ConfigError, "'[' found but ']' not found. Invalid syntax: #{param}"
end
else
if i = key.index('[')
key = key[i + 1..-1]
in_bracket = true
else
raise Fluent::ConfigError, "found more characters after ']'. Invalid syntax: #{param}"
end
end
end
result
endView on GitHub (pinned to dd45c6e18d)
Solutions
- Replace [] with a concrete index: $.array[0]
- If you meant 'iterate all elements', do the iteration in a filter/record_transformer ruby block instead of the accessor path
- Use pure bracket notation $[0] for top-level array indexing
Example fix
# before
accessor = record_accessor_create('$.items[]')
# after
accessor = record_accessor_create('$.items[0]') Defensive patterns
Strategy: try-catch
Validate before calling
# reject empty index brackets up front
raise ArgumentError, 'array index required in path' if param.include?('[]')
accessor = record_accessor_create(param) Try / catch
begin
accessor = Fluent::RecordAccessor::Accessor.new(param)
rescue Fluent::ConfigError => e
raise ArgumentError, "invalid record path #{param.inspect}: #{e.message}"
end Prevention
- Remember record_accessor has no 'all elements' wildcard
- Always emit a concrete integer inside [] when generating paths
When it happens
Trigger: record_accessor_create with a dot-notation path containing an empty bracket: $.array[], $.list[].field or $.[].
Common situations: Writing a wildcard-style '[]' expecting 'all elements' (record_accessor has no wildcard; use a filter with record_accessor per element); typos when converting $[0]-style paths to dot notation.
Related errors
- empty keys in dot notation
- whitespace character is not allowed in dot notation. Use bra
- '[' found but ']' not found. Invalid syntax: #{param}
- found more characters after ']'. Invalid syntax: #{param}
- in chunk_keys: bracket notation is not allowed
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/2602fc4b3ebacaa3.
Report an issue: GitHub.