goharbor/harbor · error

failed to connect to tcp

Error message

failed to connect to tcp:%s after %d seconds

What it means

Timeout error in TestTCPConn: repeated TCP dial attempts to the address did not succeed within the configured timeout, so the helper gives up and reports the address and elapsed seconds. It fires for unreachable hosts, closed ports, or firewalled connections (e.g. during DB/registry health checks).

Solutions

  1. Verify the target host and port are correct and the service is listening
  2. Check network/firewall rules between Harbor and the endpoint
  3. Increase the timeout or retry once the network issue is resolved
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/common/utils/utils.go:128 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/39a47b5916cfab12. Report an issue: GitHub.

Appendix: source

Thrown at src/common/utils/utils.go:128

	select {
	case <-success:
		return nil
	case <-time.After(time.Duration(timeout) * time.Second):
		cancel <- 1
		return fmt.Errorf("failed to connect to tcp:%s after %d seconds", addr, timeout)
	}
}

View on GitHub (pinned to 7b2fd08cc5)