{"record":{"id":"dd13781d672664a6","repo":"fluent/fluentd","slug":"found-but-not-found-invalid-syntax-par","errorCode":null,"errorMessage":"'[' found but ']' not found. Invalid syntax: #{param}","messagePattern":"'\\[' found but '\\]' not found\\. Invalid syntax: #(.+?)","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/record_accessor.rb","lineNumber":147,"sourceCode":"          start = key.index('[')\n          result = if start.zero?\n                     []\n                   else\n                     [key[0..start - 1]]\n                   end\n          key = key[start + 1..-1]\n          in_bracket = true\n\n          until key.empty?\n            if in_bracket\n              if i = key.index(']')\n                index_value = key[0..i - 1]\n                raise Fluent::ConfigError, \"missing array index in '[]'. Invalid syntax: #{param}\" if index_value == ']'\n                result << Integer(index_value)\n                key = key[i + 1..-1]\n                in_bracket = false\n              else\n                raise Fluent::ConfigError, \"'[' found but ']' not found. Invalid syntax: #{param}\"\n              end\n            else\n              if i = key.index('[')\n                key = key[i + 1..-1]\n                in_bracket = true\n              else\n                raise Fluent::ConfigError, \"found more characters after ']'. Invalid syntax: #{param}\"\n              end\n            end\n          end\n\n          result\n        end\n\n        def self.parse_bracket_notation(param)\n          orig_param = param\n          result = []\n          param = param[1..-1]","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/record_accessor.rb#L129-L165","documentation":"Fluent::ConfigError from Fluent::RecordAccessor's parse_dot_array_op. Once '[' is seen in dot notation, the parser scans for the matching ']'; if the remainder of the path ends before one is found, the path is syntactically incomplete and rejected with the full offending parameter in the message.","triggerScenarios":"record_accessor_create with a dot-notation path having an unclosed bracket: $.array[1, $.a[0.b, or any path ending in '[' plus digits without ']'.","commonSituations":"Truncation of long paths by shell quoting or templating; hand-joining path fragments and dropping the closing bracket; regex-extracted keys that cut off at '['.","solutions":["Close the bracket: $.array[1]","When composing paths from fragments, assert each '[' has a matching ']'","Prefer bracket notation $['key'][0] when generating paths programmatically - it is easier to build correctly"],"exampleFix":"# before\naccessor = record_accessor_create('$.items[1')\n\n# after\naccessor = record_accessor_create('$.items[1]')","handlingStrategy":"try-catch","validationCode":"# assert brackets balance before creating the accessor\nraise ArgumentError, 'unbalanced brackets' if param.count('[') != param.count(']')\naccessor = record_accessor_create(param)","typeGuard":null,"tryCatchPattern":"begin\n  Fluent::RecordAccessor::Accessor.new(param)\nrescue Fluent::ConfigError => e\n  log.error \"malformed accessor #{param.inspect}: #{e.message}\"\n  raise\nend","preventionTips":["When templating paths, build segments in an array and join at the end","Check bracket balance in generated paths during development"],"tags":["fluentd","record-accessor","dot-notation","syntax"],"backgroundTag":"invalid-path-expression","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}