Grafana Agent docker swarm error/warn logs, starting in version 0.40.2

We are currently using a Logging stack consisting of Loki 2.9.4 + Agent 0.39.2. Everything seems to be running okay. Deployment is agent in flow mode in a container, scraping logs from docker containers across different stacks in a Docker swarm.

I now wanted to migrate to Alloy, which I did not because of this issue: Fix panic loki source docker by wildum · Pull Request #875 · grafana/alloy · GitHub

Then I now wanted to at least upgrade to the latest Agent version, and am suddenly seeing these warning and error logs (I see them in 0.40.5 and 0.41.1, but not 0.39.2), which erode my trust in the setup:

ts=2024-06-12T12:53:14.058584419Z level=warn msg="could not transfer logs" component_path=/ component_id=loki.source.docker.docker_scrape target=docker/<redacted> written=0 container=<redacted> err="context canceled"
ts=2024-06-12T12:53:14.058525502Z level=error msg="could not set up a wait request to the Docker client" target=<redacted> component_path=/ component_id=loki.source.docker.docker_scrape error="context canceled"

I am just scraping the docker logs as per below config:

discovery.docker "docker_scrape" {
	host             = "unix:///var/run/docker.sock"
	refresh_interval = "5s"

	filter {
		name   = "label"
		values = ["logging=grafana-agent"]
	}
}

Any suggestions?