fluent/fluentd · error · Fluent::ConfigError
Incomplete bracket. Invalid syntax: #{orig_param}
Error message
Incomplete bracket. Invalid syntax: #{orig_param} What it means
Fluent::ConfigError from Fluent::RecordAccessor's parse_bracket_notation. When a quoted key is opened inside brackets, the parser looks for the closing quote-plus-bracket sequence ('] or "]); if neither appears in the remaining string, the bracket is unterminated and the whole path is rejected as incomplete.
Source
Thrown at lib/fluent/plugin_helper/record_accessor.rb:177
result
end
def self.parse_bracket_notation(param)
orig_param = param
result = []
param = param[1..-1]
in_bracket = false
until param.empty?
if in_bracket
if param[0] == "'" || param[0] == '"'
if i = param.index("']") || param.index('"]')
raise Fluent::ConfigError, "Mismatched quotes. Invalid syntax: #{orig_param}" unless param[0] == param[i]
result << param[1..i - 1]
param = param[i + 2..-1]
in_bracket = false
else
raise Fluent::ConfigError, "Incomplete bracket. Invalid syntax: #{orig_param}"
end
else
if i = param.index(']')
index_value = param[0..i - 1]
raise Fluent::ConfigError, "missing array index in '[]'. Invalid syntax: #{param}" if index_value == ']'
result << Integer(index_value)
param = param[i + 1..-1]
in_bracket = false
else
raise Fluent::ConfigError, "'[' found but ']' not found. Invalid syntax: #{orig_param}"
end
end
else
if i = param.index('[')
param = param[i + 1..-1]
in_bracket = true
else
raise Fluent::ConfigError, "found more characters after ']'. Invalid syntax: #{orig_param}"View on GitHub (pinned to dd45c6e18d)
Solutions
- Terminate the key: $['key'] or $["key"]
- Validate generated paths with a regex such as /\A\$\[(['"]).*\1\]\z/ before passing them on
- Keep accessor params on one line in config files
Example fix
# before
accessor = record_accessor_create("$['key")
# after
accessor = record_accessor_create("$['key']") Defensive patterns
Strategy: try-catch
Validate before calling
# reject unterminated quoted keys early
raise ArgumentError, 'accessor path not terminated' unless param.match?(%r{\]\z})
accessor = record_accessor_create(param) Try / catch
begin
Fluent::RecordAccessor::Accessor.new(param)
rescue Fluent::ConfigError => e
log.warn "dropping malformed path #{param.inspect}"
nil
end Prevention
- Keep accessor params on a single config line
- Test templated paths end-to-end; truncation usually happens at template boundaries
When it happens
Trigger: record_accessor_create with a bracket-notation path that never closes a quoted key: $['key, $["nested.field - no closing '] at the end.
Common situations: Paths truncated by shell heredocs, YAML or ERB templating that strips the tail; hand-written multiline configs breaking the path; forgetting the final ']' after the closing quote.
Related errors
- '[' found but ']' not found. Invalid syntax: #{orig_param}
- found more characters after ']'. Invalid syntax: #{orig_para
- empty keys in bracket notation
- '[' found but ']' not found. Invalid syntax: #{param}
- found more characters after ']'. Invalid syntax: #{param}
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/72756f382257bd6e.
Report an issue: GitHub.