valyala/fasthttp · error

fasthttp: connection pool strategy is not implement

Error message

fasthttp: connection pool strategy is not implement

What it means

ErrConnPoolStrategyNotImpl is returned when HostClient.ConnPoolStrategy is set to a value fasthttp does not implement yet. The client detects the unknown strategy when establishing a connection and refuses to proceed.

Source

Thrown at client.go:1801

	// to the given host.
	//
	// Increase the allowed number of connections per host if you
	// see this error.
	ErrNoFreeConns = errors.New("fasthttp: no free connections available to host")

	// ErrConnectionClosed may be returned from client methods if the server
	// closes connection before returning the first response byte.
	//
	// If you see this error, then either fix the server by returning
	// 'Connection: close' response header before closing the connection
	// or add 'Connection: close' request header before sending requests
	// to broken server.
	ErrConnectionClosed = errors.New("fasthttp: the server closed connection before returning the first response byte. " +
		"make sure the server returns 'connection: close' response header before closing the connection")

	// ErrConnPoolStrategyNotImpl is returned when HostClient.ConnPoolStrategy is not implement yet.
	// If you see this error, then you need to check your HostClient configuration.
	ErrConnPoolStrategyNotImpl = errors.New("fasthttp: connection pool strategy is not implement")
)

type timeoutError struct{}

func (e *timeoutError) Error() string {
	return "fasthttp: timeout"
}

// Timeout implements the Timeout behavior of the net.Error interface.
// This allows for checks like:
//
//	if x, ok := err.(interface{ Timeout() bool }); ok && x.Timeout() {
func (e *timeoutError) Timeout() bool {
	return true
}

// ErrTimeout is returned from timed out calls.
var ErrTimeout = &timeoutError{}

View on GitHub (pinned to c96f600972)

Solutions

  1. Set ConnPoolStrategy to a supported exported constant available in your fasthttp version
  2. Run go mod tidy / go get -u github.com/valyala/fasthttp to align the compiled version with the strategy you use
  3. Remove the ConnPoolStrategy field to fall back to default pool behavior
  4. Check go.mod/vendor for the fasthttp version actually in use

Example fix

// before
c := &fasthttp.HostClient{ConnPoolStrategy: 99} // unknown strategy
// after
c := &fasthttp.HostClient{
    Addr: "example.com:80",
    ConnPoolStrategy: fasthttp.ConnPoolStrategyDefault,
}
Defensive patterns

Strategy: validation

Validate before calling

switch hc.ConnPoolStrategy {
case fasthttp.ConnPoolStrategyDefault: // plus any supported constants in your version
    // ok
default:
    if hc.ConnPoolStrategy != 0 {
        return errors.New("unknown ConnPoolStrategy")
    }
}

Try / catch

if errors.Is(err, fasthttp.ErrConnPoolStrategyNotImpl) {
    // fall back to a client with default pool settings
}

Prevention

When it happens

Trigger: Setting HostClient.ConnPoolStrategy to an unsupported or unrecognized value (typo, a strategy constant from a newer fasthttp version than the one compiled in, or an invalid numeric value).

Common situations: Copy-pasted client config referencing a strategy from a different library version; upgrading fasthttp source while a vendored older version is actually built.

Related errors


AI-assisted analysis of valyala/fasthttp@c96f600972 (2026-08-31). Data as JSON: /api/errors/c899b8986856c14f. Report an issue: GitHub.