{"record":{"id":"7172f49529ea6853","repo":"micro/go-micro","slug":"failed-to-parse-client-pool-ttl-v","errorCode":null,"errorMessage":"failed to parse client_pool_ttl: %v","messagePattern":"failed to parse client_pool_ttl: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":645,"sourceCode":"\t\tclientOpts = append(clientOpts, client.Retries(r))\n\t}\n\n\tif t := ctx.String(\"client_request_timeout\"); len(t) > 0 {\n\t\td, err := time.ParseDuration(t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse client_request_timeout: %v\", t)\n\t\t}\n\t\tclientOpts = append(clientOpts, client.RequestTimeout(d))\n\t}\n\n\tif r := ctx.Int(\"client_pool_size\"); r > 0 {\n\t\tclientOpts = append(clientOpts, client.PoolSize(r))\n\t}\n\n\tif t := ctx.String(\"client_pool_ttl\"); len(t) > 0 {\n\t\td, err := time.ParseDuration(t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse client_pool_ttl: %v\", t)\n\t\t}\n\t\tclientOpts = append(clientOpts, client.PoolTTL(d))\n\t}\n\n\tif t := ctx.String(\"client_pool_close_timeout\"); len(t) > 0 {\n\t\td, err := time.ParseDuration(t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse client_pool_close_timeout: %v\", t)\n\t\t}\n\t\tclientOpts = append(clientOpts, client.PoolCloseTimeout(d))\n\t}\n\n\t// We have some command line opts for the server.\n\t// Lets set it up\n\tif len(serverOpts) > 0 {\n\t\tif err := (*c.opts.Server).Init(serverOpts...); err != nil {\n\t\t\tlogger.Fatalf(\"Error configuring server: %v\", err)\n\t\t}","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/cmd/cmd.go#L627-L663","documentation":"Returned by cmd/cmd.go when the --client_pool_ttl flag value fails time.ParseDuration. PoolTTL controls how long idle connections are kept in the client connection pool, and the CLI rejects any value that is not a valid Go duration string before building the client.","triggerScenarios":"Passing --client_pool_ttl with a non-duration value such as --client_pool_ttl 60 (no unit) or --client_pool_ttl 1min (should be 1m).","commonSituations":"Operators setting pool TTL in plain seconds from monitoring dashboards; templated Helm/env values defaulting to a bare number; confusion between 'm' (minutes) and 'ms' (milliseconds).","solutions":["Use a valid Go duration: 60s, 5m, 1h.","Fix unit typos (1min -> 1m, 30sec -> 30s).","Verify the value reaching the flag from env/config interpolation is non-empty and unit-suffixed.","Remove the flag to use the library default if no custom TTL is needed."],"exampleFix":"// before\n--client_pool_ttl 300\n// after\n--client_pool_ttl 300s","handlingStrategy":"validation","validationCode":"func validDuration(s string) bool { _, err := time.ParseDuration(s); return err == nil }\nif !validDuration(poolTTL) { return fmt.Errorf(\"--client_pool_ttl must be a Go duration like 60s, got %q\", poolTTL) }","typeGuard":null,"tryCatchPattern":"if _, err := time.ParseDuration(t); err != nil { return fmt.Errorf(\"invalid client_pool_ttl %q: %v\", t, err) }","preventionTips":["Suffix pool TTL values with units (60s, 5m).","Remember 'm' means minutes, 'ms' milliseconds.","Validate config-sourced durations before process launch.","Document accepted formats next to the flag in deployment templates."],"tags":["cli","configuration","duration-parsing"],"backgroundTag":"invalid-duration-format","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}