goharbor/harbor · error · lib/errors.Error

BAD_REQUEST

BAD_REQUEST

Error message

the type of filter value isn't string

What it means

Error "the type of filter value isn't string" thrown in goharbor/harbor.

Source

Thrown at src/pkg/reg/model/policy.go:48

	// Matches [pattern] for tag (default)
	Matches = "matches"
	// Excludes [pattern] for tag
	Excludes = "excludes"
)

// Filter holds the info of the filter
type Filter struct {
	Type       string `json:"type"`
	Value      any    `json:"value"`
	Decoration string `json:"decoration,omitempty"`
}

func (f *Filter) Validate() error {
	switch f.Type {
	case FilterTypeResource, FilterTypeName, FilterTypeTag:
		value, ok := f.Value.(string)
		if !ok {
			return errors.New(nil).WithCode(errors.BadRequestCode).
				WithMessage("the type of filter value isn't string")
		}
		if f.Type == FilterTypeResource {
			rt := value
			if !(rt == ResourceTypeArtifact || rt == ResourceTypeImage) {
				return errors.New(nil).WithCode(errors.BadRequestCode).
					WithMessagef("invalid resource filter: %s", value)
			}
		}
		if f.Type == FilterTypeName || f.Type == FilterTypeResource {
			if f.Decoration != "" {
				return errors.New(nil).WithCode(errors.BadRequestCode).
					WithMessage("only tag and label filter support decoration")
			}
		}
	case FilterTypeLabel:
		labels, ok := f.Value.([]any)
		if !ok {

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/pkg/reg/model/policy.go:48 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/f532f4138f173968. Report an issue: GitHub.