goharbor/harbor · error

range must start with "[", end with "]" and contains only on

Error message

range must start with "[", end with "]" and contains only one "~"

What it means

Error "range must start with "[", end with "]" and contains only one "~"" thrown in goharbor/harbor.

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)

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.