{"record":{"id":"c4ea198a19ede63c","repo":"junegunn/fzf","slug":"not-a-valid-integer-str","errorCode":null,"errorMessage":"not a valid integer: ${str}","messagePattern":"not a valid integer: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/options.go","lineNumber":827,"sourceCode":"\t\tUnsafe:       false,\n\t\tClearOnExit:  true,\n\t\tWalkerOpts:   walkerOpts{file: true, hidden: true, follow: true},\n\t\tWalkerRoot:   []string{\".\"},\n\t\tWalkerSkip:   []string{\".git\", \"node_modules\"},\n\t\tTtyDefault:   tui.DefaultTtyDevice,\n\t\tHelp:         false,\n\t\tVersion:      false}\n}\n\nfunc isDir(path string) bool {\n\tstat, err := os.Stat(path)\n\treturn err == nil && stat.IsDir()\n}\n\nfunc atoi(str string) (int, error) {\n\tnum, err := strconv.Atoi(str)\n\tif err != nil {\n\t\treturn 0, errors.New(\"not a valid integer: \" + str)\n\t}\n\treturn num, nil\n}\n\nfunc atof(str string) (float64, error) {\n\tnum, err := strconv.ParseFloat(str, 64)\n\tif err != nil {\n\t\treturn 0, errors.New(\"not a valid number: \" + str)\n\t}\n\treturn num, nil\n}\n\nfunc splitNth(str string) ([]Range, error) {\n\tif match, _ := regexp.MatchString(\"^[0-9,-.]+$\", str); !match {\n\t\treturn nil, errors.New(\"invalid format: \" + str)\n\t}\n\n\ttokens := strings.Split(str, \",\")","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L809-L845","documentation":"Returned by startHttpServer (src/server.go:115) when fzf is started with --listen 0 (ephemeral port) and the kernel-assigned address returned by listener.Addr().String() cannot be split on ':' to recover the actual port number. Because Go's net.TCPAddr.String() always renders as 'host:port' (even for IPv6 as '[::]:port'), a string with zero ':' parts is essentially unreachable; this is a defensive guard against unexpected Addr implementations or kernel oddities.","triggerScenarios":"Requires --listen 0 (port 0) AND listener.Addr().String() containing no ':' character. No standard Linux/macOS/Windows TCP listener produces such a string, so in practice this error is never observed from normal fzf usage; it exists as a sanity check in the port-extraction path (src/server.go:111-116).","commonSituations":"Not reproducible in real deployments. Theoretically conceivable with an exotic Go runtime patch, a custom netstack, or a future refactor changing how the listener address is obtained (e.g. switching to a listener type whose Addr() is a non-TCP Addr). Users seeing this message should suspect a heavily modified environment rather than configuration.","solutions":["Re-run fzf: a one-off kernel/runtime hiccup is the only plausible transient cause.","Stop using --listen 0 and pass an explicit free port (e.g. --listen 6266) so the port-extraction path is skipped entirely.","Check the Go version / report a bug to the fzf repo if this reproduces, including OS, Go version, and the address string printed in the message.","If wrapping fzf in tests with fake listeners, ensure the fake Addr() returns a valid 'host:port' TCP address."],"exampleFix":"# before\nfzf --listen 0   # (defensive path; error practically unreachable)\n\n# after\nfzf --listen 6266   # explicit port bypasses port extraction entirely","handlingStrategy":"try-catch","validationCode":"// Practically unreachable; if wrapping fzf, simply avoid --listen 0\n// and pass an explicit port so this code path is never exercised:\n//   fzf --listen 6266   (instead of: fzf --listen 0)\nnull","typeGuard":"func isPortExtractFailure(stderr string) bool {\n    return strings.Contains(stderr, \"cannot extract port: \")\n}","tryCatchPattern":"// treat as a transient/defensive failure: retry once, then fall back to a fixed port\nif err != nil && strings.Contains(stderr, \"cannot extract port\") {\n    retryOnceWith(\"--listen\", \"6266\")\n}","preventionTips":["Use explicit --listen ports in scripted/frozen environments.","Pin a known-good fzf and Go version in containers to avoid netstack surprises.","Report reproductions upstream with the printed address string."],"tags":["go","fzf","server","defensive-code","unreachable"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}