Component(s)
receiver/prometheus
What happened?
Description
Starting in 0.130.0, basic auth passwords that begin with a YAML directive began crashing the collector on startup. I believe this line is the problem:
Steps to Reproduce
Minimal config
cat << 'EOF' > config.yaml
receivers:
prometheus:
config:
scrape_configs:
- job_name: "foo"
static_configs:
- targets: ["target:8000"]
basic_auth:
username: user
password: "%password"
exporters:
otlphttp:
endpoint: https://example.com:4318
service:
pipelines:
metrics:
receivers: [prometheus]
processors: []
exporters: [otlphttp]
EOF
This command succeeds:
docker run -d \
-v "$(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml:ro" \
otel/opentelemetry-collector-contrib:0.129.1
But this command fails:
docker run -d \
-v "$(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml:ro" \
otel/opentelemetry-collector-contrib:0.130.0
Expected Result
❯ docker run -i -v "$(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml:ro" otel/opentelemetry-collector-contrib:0.129.1
2025-11-21T04:34:15.007Z info service@v0.129.0/service.go:197 Setting up own telemetry... {"resource": {"service.instance.id": "8e683d4d-d515-415a-8ef5-9b673f22b5a0", "service.name": "otelcol-contrib", "service.version": "0.129.0"}}
2025-11-21T04:34:15.008Z info service@v0.129.0/service.go:257 Starting otelcol-contrib... {"resource": {"service.instance.id": "8e683d4d-d515-415a-8ef5-9b673f22b5a0", "service.name": "otelcol-contrib", "service.version": "0.129.0"}, "Version": "0.129.0", "NumCPU": 10}
...
Actual Result
❯ docker run -i -v "$(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml:ro" otel/opentelemetry-collector-contrib:0.130.0
2025-11-21T04:35:18.937Z info service@v0.130.0/service.go:197 Setting up own telemetry... {"resource": {"service.instance.id": "8a67957b-56cb-4e17-8092-76357ad179a2", "service.name": "otelcol-contrib", "service.version": "0.130.0"}}
2025-11-21T04:35:18.938Z error service@v0.130.0/service.go:187 error found during service initialization {"resource": {"service.instance.id": "8a67957b-56cb-4e17-8092-76357ad179a2", "service.name": "otelcol-contrib", "service.version": "0.130.0"}, "error": "failed to build pipelines: failed to create \"prometheus\" receiver for data type \"metrics\": failed to reload Prometheus config: prometheus receiver: failed to marshal config to yaml: [1:1] unexpected directive value. document not started\n> 1 | %password\n ^\n"}
go.opentelemetry.io/collector/service.New.func1
go.opentelemetry.io/collector/service@v0.130.0/service.go:187
go.opentelemetry.io/collector/service.New
go.opentelemetry.io/collector/service@v0.130.0/service.go:218
go.opentelemetry.io/collector/otelcol.(*Collector).setupConfigurationComponents
go.opentelemetry.io/collector/otelcol@v0.130.0/collector.go:197
go.opentelemetry.io/collector/otelcol.(*Collector).Run
go.opentelemetry.io/collector/otelcol@v0.130.0/collector.go:312
go.opentelemetry.io/collector/otelcol.NewCommand.func1
go.opentelemetry.io/collector/otelcol@v0.130.0/command.go:39
github.com/spf13/cobra.(*Command).execute
github.com/spf13/cobra@v1.9.1/command.go:1015
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/cobra@v1.9.1/command.go:1148
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/cobra@v1.9.1/command.go:1071
main.runInteractive
github.com/open-telemetry/opentelemetry-collector-releases/contrib/main.go:70
main.run
github.com/open-telemetry/opentelemetry-collector-releases/contrib/main_others.go:10
main.main
github.com/open-telemetry/opentelemetry-collector-releases/contrib/main.go:63
runtime.main
runtime/proc.go:283
Error: failed to build pipelines: failed to create "prometheus" receiver for data type "metrics": failed to reload Prometheus config: prometheus receiver: failed to marshal config to yaml: [1:1] unexpected directive value. document not started
> 1 | %password
^
2025/11/21 04:35:18 collector server run finished with error: failed to build pipelines: failed to create "prometheus" receiver for data type "metrics": failed to reload Prometheus config: prometheus receiver: failed to marshal config to yaml: [1:1] unexpected directive value. document not started
> 1 | %password
^
Collector version
0.130.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Component(s)
receiver/prometheus
What happened?
Description
Starting in 0.130.0, basic auth passwords that begin with a YAML directive began crashing the collector on startup. I believe this line is the problem:
opentelemetry-collector-contrib/receiver/prometheusreceiver/internal/targetallocator/config.go
Line 116 in 18eb74f
Steps to Reproduce
Minimal config
This command succeeds:
But this command fails:
Expected Result
Actual Result
Collector version
0.130.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.