goharbor/harbor · error
range must start with "[", end with "]" and contains only…
Error message
range must start with "[", end with "]" and contains only one "~"
What it means
Syntax error in q.parseRange: the query range value does not end with ']' or does not contain exactly one '~', so it is not a valid '[min~max]' range token.
Solutions
- Use the form '[min~max]', e.g. '[1~100]'
- Use open-ended forms '[~100]' or '[1~]' where one bound is omitted
- Ensure exactly one '~' and enclosing brackets; drop '[' if a literal value was meant
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/q/builder.go:132 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/32a2696f0cc3a955.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/q/builder.go:132
default:
// others: exact match
return escapeValue(value), nil
}
}
func parseFuzzyMatchValue(value string) (*FuzzyMatchValue, error) {
if len(value) < 2 || value[0] != '~' {
return nil, fmt.Errorf(`fuzzy match value must start with "~" and contain at least 1 other characters`)
}
return &FuzzyMatchValue{
Value: value[1:],
}, nil
}
func parseRange(value string) (*Range, error) {
length := len(value)
if value[length-1] != ']' || strings.Count(value, "~") != 1 {
return nil, fmt.Errorf(`range must start with "[", end with "]" and contains only one "~"`)
}
strs := strings.SplitN(value[1:length-1], "~", 2)
minVal := strings.TrimSpace(strs[0])
maxVal := strings.TrimSpace(strs[1])
if len(minVal) == 0 && len(maxVal) == 0 {
return nil, fmt.Errorf(`min and max at least one should be set in range'`)
}
r := &Range{}
if len(minVal) > 0 {
r.Min = parseValue(minVal)
}
if len(maxVal) > 0 {
r.Max = parseValue(maxVal)
}
return r, nil
}
func parseOrList(value string) (*OrList, error) {View on GitHub (pinned to 7b2fd08cc5)