Skip to content

Conversation

@pavolloffay
Copy link
Member

@pavolloffay pavolloffay commented Nov 7, 2025

Description

2025-10-02T02:30:59.851Z	error	[email protected]/bearertokenauth.go:131	fsnotify: can't remove non-existent watch: /var/run/secrets/kubernetes.io/serviceaccount/token	{"resource": {"service.instance.id": "db1e09f0-e9b5-421e-b9f2-539af8965363", "service.name": "otelcol", "service.version": "0.135.0"}, "otelcol.component.id": "bearertokenauth", "otelcol.component.kind": "extension"}
github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension.(*bearerTokenAuth).startWatcher
	github.com/open-telemetry/opentelemetry-collector-contrib/extension/[email protected]/bearertokenauth.go:131

The error means the code called watcher.Remove(path) on a file that the fsnotify watcher was already no longer watching.
In the specific case of the Kubernetes service account token, this happens because Kubernetes rotates the token by deleting and replacing the file (it's an atomic update).

Link to tracking issue

Fixes

Testing

make otelcontribcol
make docker-otelcontribcol
docker tag localhost/otelcontribcol:latest pavolloffay/otelcolcontrib-bearertokenfix:1 
docker push pavolloffay/otelcolcontrib-bearertokenfix:1

docker run pavolloffay/otelcolcontrib-bearertokenfix:1

Documentation

component: extension/bearertokenauth

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove error messages `fsnotify: can't remove non-existent watch` when watching kubernetes SA tokens.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
note: Remove error messages `fsnotify: can't remove non-existent watch` when watching kubernetes SA tokens.
note: "Remove error messages `fsnotify: can't remove non-existent watch` when watching kubernetes SA tokens."

Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants