{"record":{"id":"3f97440b744c2d8a","repo":"micro/go-micro","slug":"failed-to-parse-client-request-timeout-v","errorCode":null,"errorMessage":"failed to parse client_request_timeout: %v","messagePattern":"failed to parse client_request_timeout: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":633,"sourceCode":"\t}\n\n\tif ttl := time.Duration(ctx.Int(\"register_ttl\")); ttl >= 0 {\n\t\tserverOpts = append(serverOpts, server.RegisterTTL(ttl*time.Second))\n\t}\n\n\tif val := time.Duration(ctx.Int(\"register_interval\")); val >= 0 {\n\t\tserverOpts = append(serverOpts, server.RegisterInterval(val*time.Second))\n\t}\n\n\t// client opts\n\tif r := ctx.Int(\"client_retries\"); r >= 0 {\n\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)","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/cmd/cmd.go#L615-L651","documentation":"This error is returned by the CLI flag-parsing code in cmd/cmd.go when the value passed to the --client_request_timeout flag cannot be parsed by time.ParseDuration. The framework wraps client configuration options and fails fast before any request is made, so the client is never constructed with an invalid timeout. Note the message prints the raw string value, not the parse error itself.","triggerScenarios":"Running the binary with --client_request_timeout set to a string that is not a valid Go duration, e.g. --client_request_timeout 500 (missing unit) or --client_request_timeout 5sec (unsupported unit).","commonSituations":"Users copying timeout values from config files written in seconds/milliseconds ('500ms' works but '0.5' does not); CI scripts interpolating empty or unquoted values; mixing formats like '30s' vs '30'.","solutions":["Pass a duration with a unit: 30s, 500ms, 1m, 2h.","Check the flag value in your script/env for typos or empty interpolation.","If unset is desired, remove the flag entirely rather than passing an empty/invalid string.","If the value comes from a config file, validate it with time.ParseDuration before launching."],"exampleFix":"// before\n./server --client_request_timeout 500\n// after\n./server --client_request_timeout 500ms","handlingStrategy":"validation","validationCode":"func validDuration(s string) bool { _, err := time.ParseDuration(s); return err == nil }\nif !validDuration(flagValue) { return fmt.Errorf(\"--client_request_timeout must be a Go duration like 500ms, got %q\", flagValue) }","typeGuard":null,"tryCatchPattern":"if _, err := time.ParseDuration(t); err != nil { return fmt.Errorf(\"invalid client_request_timeout %q: %v\", t, err) }","preventionTips":["Always include a time unit in duration flags (500ms, 30s).","Validate duration env/config values at startup with time.ParseDuration.","Avoid bare numbers in scripts; quote and unit-suffix interpolated values.","Centralize duration parsing in one helper with clear errors."],"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"}