goharbor/harbor · error · *errors.Error
BAD_REQUEST
BAD_REQUEST
Error message
the N must be a positive int type
What it means
Error "the N must be a positive int type" thrown in goharbor/harbor.
Source
Thrown at src/server/registry/util/util.go:70
sort.Strings(strs)
}
i := sort.Search(len(strs), func(i int) bool { return x <= strs[i] })
if i < len(strs) && strs[i] == x {
return i
}
return -1
}
// ParseNAndLastParameters parse the n and last parameters from the query of the http request
func ParseNAndLastParameters(r *http.Request) (*int, string, error) {
q := r.URL.Query()
var n *int
if q.Get("n") != "" {
value, err := strconv.Atoi(q.Get("n"))
if err != nil || value < 0 {
return nil, "", errors.New(err).WithCode(errors.BadRequestCode).WithMessage("the N must be a positive int type")
}
n = &value
}
return n, q.Get("last"), nil
}
// SendListTagsResponse sends the response for list tags API
func SendListTagsResponse(w http.ResponseWriter, r *http.Request, tags []string) {
n, last, err := ParseNAndLastParameters(r)
if err != nil {
libhttp.SendError(w, err)
return
}
items, nextLast := pickItems(sortedAndUniqueItems(tags), n, last)
View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/server/registry/util/util.go:70 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/f491ba900a4c3bb7.
Report an issue: GitHub.