micro/go-micro · error

failed to parse client_pool_close_timeout: %v

Error message

failed to parse client_pool_close_timeout: %v

What it means

Returned by cmd/cmd.go when the --client_pool_close_timeout flag value fails time.ParseDuration. This timeout bounds how long the client waits when draining and closing pooled connections, and invalid values abort startup before any connection is made.

Source

Thrown at cmd/cmd.go:653

		clientOpts = append(clientOpts, client.RequestTimeout(d))
	}

	if r := ctx.Int("client_pool_size"); r > 0 {
		clientOpts = append(clientOpts, client.PoolSize(r))
	}

	if t := ctx.String("client_pool_ttl"); len(t) > 0 {
		d, err := time.ParseDuration(t)
		if err != nil {
			return fmt.Errorf("failed to parse client_pool_ttl: %v", t)
		}
		clientOpts = append(clientOpts, client.PoolTTL(d))
	}

	if t := ctx.String("client_pool_close_timeout"); len(t) > 0 {
		d, err := time.ParseDuration(t)
		if err != nil {
			return fmt.Errorf("failed to parse client_pool_close_timeout: %v", t)
		}
		clientOpts = append(clientOpts, client.PoolCloseTimeout(d))
	}

	// We have some command line opts for the server.
	// Lets set it up
	if len(serverOpts) > 0 {
		if err := (*c.opts.Server).Init(serverOpts...); err != nil {
			logger.Fatalf("Error configuring server: %v", err)
		}
	}

	// Use an init option?
	if len(clientOpts) > 0 {
		if err := (*c.opts.Client).Init(clientOpts...); err != nil {
			logger.Fatalf("Error configuring client: %v", err)
		}
	}

View on GitHub (pinned to 24529f1404)

Solutions

  1. Provide a valid duration: 10s, 500ms.
  2. Correct the unit casing: 10s not 10S.
  3. Check env/config interpolation for empty or numeric-only values.
  4. Omit the flag to accept the library default.

Example fix

// before
--client_pool_close_timeout 10
// after
--client_pool_close_timeout 10s
Defensive patterns

Strategy: validation

Validate before calling

func validDuration(s string) bool { _, err := time.ParseDuration(s); return err == nil }
if !validDuration(closeTimeout) { return fmt.Errorf("--client_pool_close_timeout must be a Go duration like 10s, got %q", closeTimeout) }

Try / catch

if _, err := time.ParseDuration(t); err != nil { return fmt.Errorf("invalid client_pool_close_timeout %q: %v", t, err) }

Prevention

When it happens

Trigger: Passing --client_pool_close_timeout with an invalid duration like 10 (missing unit) or 'ten seconds'.

Common situations: Copy-paste from docs where the unit was lost; scripts generating flags with default numeric values; typo like 5S (capital S is not accepted... actually 'S' is invalid; use 5s).

Understand the failure class

Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.

Related errors


AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01). Data as JSON: /api/errors/059058f0f18e9232. Report an issue: GitHub.