JuliusBrussee/caveman · error
listen address must be loopback host:port
Error message
listen address %q must be loopback host:port
What it means
The listen address could not be split into a non-empty host and port, so it is not a valid host:port pair for a loopback listener. validateListen runs SplitHostPort and requires both parts to be present.
Solutions
- Use an explicit loopback host:port, e.g. "127.0.0.1:8080" or "localhost:8080".
- For IPv6 loopback, bracket the address: "[::1]:8080".
- Strip stray whitespace/quotes from the config value (the function already trims spaces, but not quotes).
Example fix
// before listen = "127.0.0.1" // after listen = "127.0.0.1:8080"
Defensive patterns
Strategy: validation
Validate before calling
host, port, err := net.SplitHostPort(strings.TrimSpace(listen))
if err != nil || port == "" {
return fmt.Errorf("listen must be host:port, got %q", listen)
} Prevention
- Always specify listen as host:port (e.g. 127.0.0.1:8080).
- Bracket IPv6 addresses: [::1]:8080.
- Lint config files for required :port suffix on listen values.
When it happens
Trigger: Setting the listen config to a value like ":8080" (empty host with bad split outcome), "127.0.0.1" (missing port), ":" (empty port), or a value with a stray bracket/colon that SplitHostPort cannot parse; Load then returns this error.
Common situations: Forgetting the :port suffix; writing a bare IPv6 address without brackets; typo like "localhost::8080"; config value containing extra quotes copied from docs.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- upstream_proxy must be "env", "off" or a proxy URL
- : MCP ownership journal failed; native config may already…
- AbortError
- MCP transaction failed and rolled back
- MCP transaction failed and safe recovery was blocked: …
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/2255303a268092dd.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/internal/config/config.go:317
}
for _, r := range token {
if r == ' ' || r < 0x20 || r == 0x7f {
return fmt.Errorf("CAVEMAN_AUTH_TOKEN must contain no spaces or control characters")
}
}
return nil
}
// validateListen keeps standalone's BYOK proxy local to one operator unless an
// inbound credential gates it. Binding an empty, wildcard, or non-loopback host
// would expose every configured provider credential to the network with no
// inbound authentication; authenticated says CAVEMAN_AUTH_TOKEN is set, so
// standalone.Auth rejects every request that does not present it and the wider
// bind becomes a deliberate operator choice instead of an accident.
func validateListen(listen string, authenticated bool) error {
host, port, err := net.SplitHostPort(strings.TrimSpace(listen))
if err != nil || port == "" {
return fmt.Errorf("listen address %q must be loopback host:port", listen)
}
if strings.EqualFold(host, "localhost") {
return nil
}
ip := net.ParseIP(host)
if ip == nil || !ip.IsLoopback() {
if authenticated {
return nil
}
return fmt.Errorf("listen address %q is not loopback; standalone proxy has no inbound authentication; set CAVEMAN_AUTH_TOKEN to expose the proxy beyond loopback", listen)
}
return nil
}
func (c Config) withDefaults() Config {
if label := env.String("CAVEMAN_LABEL", ""); label != "" {
c.Label = label
}View on GitHub (pinned to 3ee70a1026)