{"record":{"id":"e3dedb5aa2b45fad","repo":"fluent/fluentd","slug":"mismatched-quotes-invalid-syntax-orig-param","errorCode":null,"errorMessage":"Mismatched quotes. Invalid syntax: #{orig_param}","messagePattern":"Mismatched quotes\\. Invalid syntax: #(.+?)","errorType":"exception","errorClass":"Fluent::ConfigError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/record_accessor.rb","lineNumber":172,"sourceCode":"                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]\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","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/record_accessor.rb#L154-L190","documentation":"Fluent::ConfigError from Fluent::RecordAccessor's parse_bracket_notation. When a bracket-notation key is quoted, the opening quote character must match the character right before the closing ']' - '$['...'\" ... must end with '] and \"$[\"...\"]\" must end with \"]. Mixing quote styles fails the param[0] == param[i] check and raises with the original path.","triggerScenarios":"record_accessor_create with a mismatched-quoted bracket key: $['key\"] or $[\"key'] - the opener and the quote preceding ']' differ.","commonSituations":"Building paths by string interpolation where the closing sequence is hardcoded as \"']\" regardless of the opener; converting between single- and double-quoted styles by hand and editing only one side.","solutions":["Use matching quotes on both sides: $['key'] or $[\"key\"]","When generating paths in code, emit the closer from the same variable as the opener","Skip quotes entirely for simple identifier keys: $.key or $[key]"],"exampleFix":"# before\naccessor = record_accessor_create('$[\\'key\"]')\n\n# after\naccessor = record_accessor_create(\"$['key']\")","handlingStrategy":"try-catch","validationCode":"# verify quote pairing before use\nok = param.match?(%r{\\A\\$\\[(['\"]).*\\1\\]\\z})\nraise ArgumentError, 'quotes in accessor path do not match' unless ok\naccessor = record_accessor_create(param)","typeGuard":null,"tryCatchPattern":"begin\n  Fluent::RecordAccessor::Accessor.new(param)\nrescue Fluent::ConfigError => e\n  raise ArgumentError, \"mismatched quoting in #{param.inspect}\"\nend","preventionTips":["Derive both the opener and closer from one variable when generating quoted keys","Use unquoted $.key form for plain identifier keys"],"tags":["fluentd","record-accessor","bracket-notation","quoting"],"backgroundTag":"invalid-path-expression","analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}