From fd7e80ae174fc006981c02d126f55fc50690a764 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 3 Jan 2026 20:56:04 +0000 Subject: [PATCH] fix: Add clear warning when Docker token is already in use When a Docker agent tries to register with a token that's already bound to another agent, the error was logged generically as "Failed to send docker report". Users had to dig into logs to understand the issue. Now logs a prominent error message: "DOCKER REGISTRATION FAILED: This API token is already used by another Docker agent. Each Docker host requires its own unique token. Generate a new token in Pulse Settings > Agents and reinstall with the new token." Related to #1027 --- internal/dockeragent/agent.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/dockeragent/agent.go b/internal/dockeragent/agent.go index 3ff398f2c..a3309f25b 100644 --- a/internal/dockeragent/agent.go +++ b/internal/dockeragent/agent.go @@ -699,6 +699,14 @@ func (a *Agent) sendReportToTarget(ctx context.Context, target TargetConfig, pay if errMsg == "" { errMsg = resp.Status } + // Detect token-already-in-use error and log a clear warning + if strings.Contains(errMsg, "already in use") { + a.logger.Error(). + Str("pulseURL", target.URL). + Msg("DOCKER REGISTRATION FAILED: This API token is already used by another Docker agent. " + + "Each Docker host requires its own unique token. " + + "Generate a new token in Pulse Settings > Agents and reinstall with the new token.") + } return fmt.Errorf("target %s: pulse responded %s: %s", target.URL, resp.Status, errMsg) }