amir20/dozzle · error

error fetching host info for agent

Error message

error fetching host info for agent: %w

What it means

Returned by AgentTestCmd.Run when agent.Host(ctx) fails or times out fetching host info over the established gRPC connection. The dial succeeded but the Host RPC returned an error, was rejected, or hit the --timeout deadline.

Solutions

  1. Increase --timeout, e.g. --timeout 30s, and retry.
  2. Verify the agent's local Docker daemon is healthy on the remote host (`docker info` there).
  3. Align versions: run the same dozzle release for CLI/tester and agent.
  4. Check agent logs on the remote host for RPC errors at call time.
  5. Retry after network blips; if persistent, restart the remote agent.

Example fix

// before
./dozzle agent-test 10.0.0.5:7007  # default timeout too short over WAN
// after
./dozzle agent-test --timeout 30s 10.0.0.5:7007
Defensive patterns

Strategy: retry

Validate before calling

# pre-check: agent port reachable and reasonable latency
nc -zv "${ADDR%%:*}" "${ADDR##*:}"

Try / catch

err := agentTestCmd.Run(args, embeddedCerts)
if err != nil && strings.Contains(err.Error(), "error fetching host info") {
  time.Sleep(2 * time.Second)
  args.Timeout = 30 * time.Second
  err = agentTestCmd.Run(args, embeddedCerts)
}

Prevention

When it happens

Trigger: --timeout too small for a slow link; agent accepts the connection but its internal Docker client is unhealthy so the RPC errors; agent version incompatibility causes a proto mismatch; stream reset mid-call.

Common situations: Testing a remote agent over a high-latency WAN with the default short timeout; agent up but Docker daemon hung; running a very old agent against a new CLI (or vice versa).

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/8709a873d1defffa. Report an issue: GitHub.

Appendix: source

Thrown at internal/support/cli/agent_test_command.go:32

}

func (at *AgentTestCmd) Run(args Args, embeddedCerts embed.FS) error {
	certs, err := ReadCertificates(embeddedCerts, args.CertPath, args.KeyPath)
	if err != nil {
		return fmt.Errorf("error reading certificates: %w", err)
	}

	log.Info().Str("endpoint", args.AgentTest.Address).Msg("Connecting to agent")

	agent, err := agent.NewClient(args.AgentTest.Address, certs)
	if err != nil {
		return fmt.Errorf("error connecting to agent: %w", err)
	}
	ctx, cancel := context.WithTimeout(context.Background(), args.Timeout)
	defer cancel()
	host, err := agent.Host(ctx)
	if err != nil {
		return fmt.Errorf("error fetching host info for agent: %w", err)
	}

	log.Info().Str("endpoint", args.AgentTest.Address).Str("version", host.AgentVersion).Str("name", host.Name).Str("id", host.ID).Msg("Successfully connected to agent")

	return nil
}

View on GitHub (pinned to d9463cbe21)