goharbor/harbor · error

fuzzy match value must start with "~" and contain at least 1

Error message

fuzzy match value must start with "~" and contain at least 1 other characters

What it means

Error "fuzzy match value must start with "~" and contain at least 1 other characters" thrown in goharbor/harbor.

Source

Thrown at src/lib/q/builder.go:122

	}
	switch value[0] {
	case '~':
		return parseFuzzyMatchValue(value)
	case '[':
		return parseRange(value)
	case '{':
		return parseOrList(value)
	case '(':
		return parseAndList(value)
	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{}

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/lib/q/builder.go:122 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/89b99acbd1dcff65. Report an issue: GitHub.