Skip to content

Elastic Agent: env provider fails with unhelpful log message %!s(<nil>) #9284

@dybul101

Description

@dybul101

Elastic Agent Version:
8.18.4 (running as Fleet-managed agent via Helm Chart)

Elastic Stack Version (Cloud):
8.18.4 (Elastic Cloud deployment)

Deployment Context:
Agent deployed via Helm (elastic-agent chart v8.18.4)
Mode: daemonset

All required ${env.*} variables are explicitly defined using extraEnvs in the Helm chart
Variables include:
NODE_NAME
NODE_IP
POD_NAME
KUBERNETES_SERVICE_HOST
KUBERNETES_SERVICE_PORT
etc.

Observed Behavior:
In the Elastic Agent logs, the following error message appears repeatedly every 30 seconds:

provider "env" failed to run (will retry in 30s): %!s()

Expected Behavior:
Either no error (if all required env values are present), or
A meaningful error message indicating which variable is missing or causing the failure

Actual Behavior:
The log contains a Go formatting fallback string %!s(), which strongly suggests that the error value passed to the logger is nil, and the Stringer is not handled correctly.

Code Reference:
The problematic log line seems to originate from controller.go line 471, inside the composable.providers.env provider controller:

logger.Errorf("provider %q failed to run (will retry in %s): %s", provider.Type(), retryDur, err)

If err is nil, this results in the log message:
provider "env" failed to run (will retry in 30s): %!s()

Root Cause Hypothesis:
err may be nil, and the retry mechanism is triggered regardless

Notes:
Agent behavior is otherwise functional — all Kubernetes metrics and logs are collected correctly and delivered to Elastic
This issue affects log clarity and may mislead users during debugging

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions