Extended list for environment variables don't work
- Dominant language
- C
- Stars
- 8.1k
- Forks
- 2k
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 58
Description
## Bug Report
**Describe the bug**
The official documentation for [YAML Environment Variables](https://docs.fluentbit.io/manual/4.2/administration/configuring-fluent-bit/yaml/environment-variables-section#extended-list-form) documents an "Extended list form" for the `env` section (using `- name: ...`, `uri: ...`, `refresh_interval: ...`).
However, using this documented syntax causes Fluent Bit to fail on startup with a YAML parse error:
`unexpected event 'sequence-start-event' (7) in state 'env' (41)`.
The YAML parser (`flb_cf_yaml.c`) state machine for `STATE_ENV` strictly expects a mapping (`YAML_MAPPING_START_EVENT`) and rejects sequences (`YAML_SEQUENCE_START_EVENT`), making the documented extended list syntax completely unusable.
**To Reproduce**
- Example log message:
```text
[error] [config] YAML error found in file "/fluent-bit/etc/fluent-bit.yaml", line 2, column 2: unexpected event 'sequence-start-event' (7) in state 'env' (41).
[error] yaml error
[error] configuration file contains errors, aborting.
```
- Steps to reproduce the problem:
1. Create a `fluent-bit.yaml` file with the exact example from the documentation:
```yaml
env:
- name: DB_PASSWORD
uri: file:///run/secrets/db_password
refresh_interval: 60
- name: REGION
value: us-east-1
service:
flush: 1
log_level: info
pipeline:
inputs:
- name: dummy
outputs:
- name: stdout
match: '*'
```
2. Run Fluent Bit:
```bash
fluent-bit -c fluent-bit.yaml
```
3. Fluent Bit aborts during configuration parsing.
**Expected behavior**
Either:
1. The YAML configuration parser should support the documented extended list form for dynamic secret/file loading under `env:`, OR
2. The documentation should be updated/corrected to state that only the map form (`env: KEY: value`) is supported, removing the invalid extended list examples.
**Your Environment**
* Version used: `4.2.7` (reproduced on `fluent/fluent-bit:4.2.7-debug`)
* Configuration: Minimal YAML configuration containing the documented `env:` list syntax
* Environment name and version: Docker / Container
* Operating System and version: Linux
**Additional context**
Documented at: https://docs.fluentbit.io/manual/4.2/administration/configuring-fluent-bit/yaml/environment-variables-section#extended-list-form
Contributor guide
Research direction
Start with flb_cf_yaml.c and the STATE_ENV handling, then run the documented environment-variable YAML example with Fluent Bit 4.2.7 to reproduce the parse error. Compare the parser behavior with the extended-list syntax described in the linked documentation; done means either that syntax parses successfully or the documentation no longer presents it as supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100