fatedier/frp · error
range number is invalid
Error message
range number is invalid
What it means
Returned by ParseRangeNumbers when a range token's bounds parse successfully but maxValue < minValue, e.g. "2000-1000". This variant carries no %v detail because it is a semantic (not syntactic) failure: the range is inverted. Expansion of an inverted range is rejected rather than silently producing an empty set.
Source
Thrown at pkg/util/util/util.go:99
if errRet != nil {
err = fmt.Errorf("range number is invalid, %v", errRet)
return
}
numbers = append(numbers, singleNum)
case 2:
// range numbers
minValue, errRet := strconv.ParseInt(strings.TrimSpace(numArray[0]), 10, 64)
if errRet != nil {
err = fmt.Errorf("range number is invalid, %v", errRet)
return
}
maxValue, errRet := strconv.ParseInt(strings.TrimSpace(numArray[1]), 10, 64)
if errRet != nil {
err = fmt.Errorf("range number is invalid, %v", errRet)
return
}
if maxValue < minValue {
err = fmt.Errorf("range number is invalid")
return
}
for i := minValue; i <= maxValue; i++ {
numbers = append(numbers, i)
}
default:
err = fmt.Errorf("range number is invalid")
return
}
}
return
}
func GenerateResponseErrorString(summary string, err error, detailed bool) string {
if detailed {
return err.Error()
}
return summaryView on GitHub (pinned to 6c8a8d0a97)
Solutions
- Swap the bounds so the smaller number comes first: "8000-9000"
- Prefer explicit single ports if you only need a few, avoiding long ranges
- Verify with frpc verify before restarting the client
Example fix
# before ports = "9100-9000" # after ports = "9000-9100"
Defensive patterns
Strategy: validation
Validate before calling
func rangeOrderValid(s string) bool {
for _, tok := range strings.Split(s, ",") {
parts := strings.Split(strings.TrimSpace(tok), "-")
if len(parts) == 2 {
lo, e1 := strconv.ParseInt(strings.TrimSpace(parts[0]), 10, 64)
hi, e2 := strconv.ParseInt(strings.TrimSpace(parts[1]), 10, 64)
if e1 != nil || e2 != nil || hi < lo { return false }
}
}
return true
} Prevention
- Always write ranges low-high
- Diff-review config edits that touch range values
- frpc verify fails fast on inverted ranges
When it happens
Trigger: Any dash-separated token where the left number is greater than the right: "9000-8000". Config fields for port ranges in frpc/frps parsed by ParseRangeNumbers.
Common situations: Reordering ports while editing config and swapping the bounds; auto-generated range templates filled in the wrong order.
Related errors
- range number is invalid, %v
- auth.oidc.clientID is required; auth.oidc.tokenEndpointURL i
- localAddr is required
- localPath is required
- unixPath is required
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/f4d60a76cd906f59.
Report an issue: GitHub.