txthinking/brook · error
Looks like you want create socks5 from a socks5, you may wan
Error message
Looks like you want create socks5 from a socks5, you may want $ brook socks5tohttp?
What it means
The socks5 subcommand is meant to wrap a non-socks5 upstream (a brook link, ss link, etc.) and expose it as a local socks5 server. brook.ParseLink returns kind == "socks5" for a socks5:// link, and since wrapping socks5-in-socks5 is meaningless (and socks5tohttp exists for the reverse direction), main.go:493 rejects it with this guidance error.
Source
Thrown at cli/brook/main.go:493
}
if c.String("socks5ServerIP") != "" {
h = c.String("socks5ServerIP")
}
if h == "" {
return errors.New("socks5 server requires a clear IP for UDP, only port is not enough. You may use loopback IP or lan IP or other, we can not decide for you")
}
kind, _, v, err := brook.ParseLink(link)
if err != nil {
return err
}
if s := v.Get("clientHKDFInfo"); s != "" {
brook.ClientHKDFInfo = []byte(s)
}
if s := v.Get("serverHKDFInfo"); s != "" {
brook.ServerHKDFInfo = []byte(s)
}
if kind == "socks5" {
return errors.New("Looks like you want create socks5 from a socks5, you may want $ brook socks5tohttp?")
}
s, err := brook.NewBrookLink(link)
if err != nil {
return err
}
err = s.PrepareSocks5Server(c.String("socks5"), h, c.Int("tcpTimeout"), c.Int("udpTimeout"))
if err != nil {
return err
}
g.Add(&runnergroup.Runner{
Start: func() error {
return s.ListenAndServe()
},
Stop: func() error {
return s.Shutdown()
},
})
if c.String("http") != "" {View on GitHub (pinned to 5cd13ef3b1)
Solutions
- If the goal is a local socks5 for an existing socks5 server, just use the socks5 server directly — no wrapping needed
- If you wanted HTTP from socks5, run `brook socks5tohttp --from socks5://...` as the message suggests
- Use a non-socks5 link (brook:// or ss://) as the --from value for this subcommand
Example fix
// before brook socks5 --from socks5://user:pass@1.2.3.4:1080 // after brook socks5tohttp --from socks5://user:pass@1.2.3.4:1080 // or, for a brook upstream: brook socks5 --from brook://1.2.3.4:9999
Defensive patterns
Strategy: validation
Validate before calling
case "${from%%://*}" in
socks5) echo "upstream is already socks5; use it directly or run brook socks5tohttp" >&2; exit 1 ;;
esac Prevention
- Check the URI scheme of upstream links before feeding them to the socks5 subcommand
- Remember the mapping: brook/ss links -> `brook socks5` wrapper; socks5 -> `brook socks5tohttp` for HTTP output
- Validate generated proxy URIs in automation to avoid nesting socks5 inside socks5
When it happens
Trigger: Running `brook socks5 --from socks5://user:pass@host:1080 ...` — i.e. passing a link whose parsed scheme/kind is "socks5" into the socks5 subcommand.
Common situations: Users who already have a socks5 server and want a local proxy copy-paste it as the upstream link; automation pipelines that generically feed proxy URIs without checking the scheme; confusion between the socks5 (server wrapper) and socks5tohttp subcommands.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- socks5 server requires a clear IP for UDP, only port is not
- --cert must be with absolute path
- --certkey must be with absolute path
- socks5 server requires a clear IP for UDP, only port is not
- cannot create exchanger from
AI-assisted analysis of txthinking/brook@5cd13ef3b1 (2026-09-06).
Data as JSON: /api/errors/3642940f637fa2ce.
Report an issue: GitHub.