Skip to content

YAML Config File Syntax: Single int value for an array option causes a config error #5149

@daipom

Description

@daipom

Describe the bug

In YAML syntax, a single int value for an array option causes a config error.

Found in the following fix.

Note: This PR doesn't address the issue where setting an Int directly to an Array option causes ConfigError: retryable_response_codes: 503 (The C case in #5126 (comment))
It could be a different issue.

The current behavior is inconsistent and somewhat unnatural.

Unnatural current behavior:

  • An error occurs only when a single int value is specified for an array option.
  • It can be avoided by setting it as a String.
  • There’s no such issue with options that are initially String arrays.
  • There’s no such issue with the normal config syntax.

To Reproduce

NG(Causes config error file="..." error_class=Fluent::ConfigError error="array required but got 503"):

config:
  - match:
      $type: http
      $tag: test
      endpoint: http://localhost:9880/tag
      retryable_response_codes: 503

OK as YAML syntax:

config:
  - match:
      $type: http
      $tag: test
      endpoint: http://localhost:9880/tag
      retryable_response_codes: "503"
config:
  - match:
      $type: http
      $tag: test
      endpoint: http://localhost:9880/tag
      retryable_response_codes: 503,

OK as normal syntax:

<match test>
  @type http
  endpoint "http://localhost:9880/tag"
  retryable_response_codes 503
</match>

OK as YAML syntax since v1.19.1 (after #5126):

config:
  - match:
      $type: http
      $tag: test
      endpoint: http://localhost:9880/tag
      retryable_response_codes: [503]
config:
  - match:
      $type: http
      $tag: test
      endpoint: http://localhost:9880/tag
      retryable_response_codes:
        - 503

Please also refer to the C case in #5126 (comment).

Expected behavior

Fluentd can parse a single int value for an array option, such as the following:

config:
  - match:
      $type: http
      $tag: test
      endpoint: http://localhost:9880/tag
      retryable_response_codes: 503

Your Environment

- Fluentd version: v1.19.1
- Package version: None
- Operating system: Ubuntu 22.04.5 LTS
- Kernel version: 6.8.0-85-generic

Your Configuration

See `To reproduce`.

Your Error Log

2025-11-11 14:27:25 +0900 [info]: init supervisor logger path=nil rotate_age=nil rotate_size=nil
2025-11-11 14:27:25 +0900 [info]: parsing config file is succeeded path="/test/fluentd/config/yaml/tmp.yaml"
2025-11-11 14:27:25 +0900 [info]: inaccessible include directory was specified path="/etc/fluent/conf.d"
2025-11-11 14:27:25 +0900 [info]: gem 'fluentd' version '1.19.1'
2025-11-11 14:27:25 +0900 [error]: config error in:
<match test>
  @type http
  endpoint "http://localhost:9880/tag"
  retryable_response_codes 503
</match>

2025-11-11 14:27:25 +0900 [error]: config error file="/test/fluentd/config/yaml/tmp.yaml" error_class=Fluent::ConfigError error="array required but got 503"

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions