{"record":{"id":"72756f382257bd6e","repo":"fluent/fluentd","slug":"incomplete-bracket-invalid-syntax-orig-param","errorCode":null,"errorMessage":"Incomplete bracket. Invalid syntax: #{orig_param}","messagePattern":"Incomplete bracket\\. Invalid syntax: #(.+?)","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/record_accessor.rb","lineNumber":177,"sourceCode":"          result\n        end\n\n        def self.parse_bracket_notation(param)\n          orig_param = param\n          result = []\n          param = param[1..-1]\n          in_bracket = false\n\n          until param.empty?\n            if in_bracket\n              if param[0] == \"'\" || param[0] == '\"'\n                if i = param.index(\"']\") || param.index('\"]')\n                  raise Fluent::ConfigError, \"Mismatched quotes. Invalid syntax: #{orig_param}\" unless param[0] == param[i]\n                  result << param[1..i - 1]\n                  param = param[i + 2..-1]\n                  in_bracket = false\n                else\n                  raise Fluent::ConfigError, \"Incomplete bracket. Invalid syntax: #{orig_param}\"\n                end\n              else\n                if i = param.index(']')\n                  index_value = param[0..i - 1]\n                  raise Fluent::ConfigError, \"missing array index in '[]'. Invalid syntax: #{param}\" if index_value == ']'\n                  result << Integer(index_value)\n                  param = param[i + 1..-1]\n                  in_bracket = false\n                else\n                  raise Fluent::ConfigError, \"'[' found but ']' not found. Invalid syntax: #{orig_param}\"\n                end\n              end\n            else\n              if i = param.index('[')\n                param = param[i + 1..-1]\n                in_bracket = true\n              else\n                raise Fluent::ConfigError, \"found more characters after ']'. Invalid syntax: #{orig_param}\"","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/record_accessor.rb#L159-L195","documentation":"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.","triggerScenarios":"record_accessor_create with a bracket-notation path that never closes a quoted key: $['key, $[\"nested.field - no closing '] at the end.","commonSituations":"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.","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"],"exampleFix":"# before\naccessor = record_accessor_create(\"$['key\")\n\n# after\naccessor = record_accessor_create(\"$['key']\")","handlingStrategy":"try-catch","validationCode":"# reject unterminated quoted keys early\nraise ArgumentError, 'accessor path not terminated' unless param.match?(%r{\\]\\z})\naccessor = record_accessor_create(param)","typeGuard":null,"tryCatchPattern":"begin\n  Fluent::RecordAccessor::Accessor.new(param)\nrescue Fluent::ConfigError => e\n  log.warn \"dropping malformed path #{param.inspect}\"\n  nil\nend","preventionTips":["Keep accessor params on a single config line","Test templated paths end-to-end; truncation usually happens at template boundaries"],"tags":["fluentd","record-accessor","bracket-notation","syntax"],"backgroundTag":"invalid-path-expression","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}