Skip to content

Backport(v1.19): record_accessor: raise ConfigError for a non-integer array index (#5596) - #5610

Merged
Watson1978 merged 1 commit into
v1.19from
backport-to-v1.19/pr5596
Nov 9, 2026
Merged

Watson1978 merged 1 commit into
v1.19from
backport-to-v1.19/pr5596

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Which issue(s) this PR fixes:
Backport #5596
Fixes #5595

What this PR does / why we need it:

A record_accessor key with a non-integer array index, such as $.a[x] or $['a'][x], reached Integer(index_value) and raised ArgumentError. Fluentd stopped with "unexpected error" (or a backtrace on 1.16) instead of a config error.

Now both the dot and the bracket parsers raise Fluent::ConfigError, like the other syntax errors next to them.

Before:

$.a[x]: ArgumentError: invalid value for Integer(): "x"

After, with the configuration from the issue and fluentd --dry-run:

[error]: config error file="f.conf" error_class=Fluent::ConfigError error="array index must be an integer: 'x'. Invalid syntax: $.a[x]"

Tests: added both keys to the two invalid syntax data sets in test/plugin_helper/test_record_accessor.rb. They fail on master with ArgumentError and pass with this change.

Docs Changes:

N/A

Release Note:

record_accessor: report a non-integer array index such as $.a[x] as a config error.

A key such as `$.a[x]` or `$['a'][x]` made Integer() raise
ArgumentError, so Fluentd stopped with an unexpected error instead of
reporting a config error with the file name. Convert it to
Fluent::ConfigError like the other syntax errors next to it.

Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@Watson1978 Watson1978 added this to the v1.19.5 milestone Nov 9, 2026
@Watson1978
Watson1978 merged commit f171ce8 into v1.19 Nov 9, 2026
21 checks passed
@Watson1978
Watson1978 deleted the backport-to-v1.19/pr5596 branch November 9, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants