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/catalog.go:50
repoMgr: pkg.RepositoryMgr,
}
}
type repositoryHandler struct {
repoMgr repository.Manager
}
func (r *repositoryHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
var maxEntries int
var err error
reqQ := req.URL.Query()
lastEntry := reqQ.Get("last")
withN := reqQ.Get("n") != ""
if withN {
maxEntries, err = strconv.Atoi(reqQ.Get("n"))
if err != nil || maxEntries < 0 {
err := errors.New(err).WithCode(errors.BadRequestCode).WithMessage("the N must be a positive int type")
lib_http.SendError(w, err)
return
}
}
repoNames := make([]string, 0)
// get all the non repositories
repoRecords, err := r.repoMgr.NonEmptyRepos(req.Context())
if err != nil {
lib_http.SendError(w, err)
return
}
if len(repoRecords) <= 0 {
r.sendResponse(w, req, repoNames)
return
}
for _, repo := range repoRecords {
repoNames = append(repoNames, repo.Name)View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/server/registry/catalog.go:50 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/3b7e24a44ef61a22.
Report an issue: GitHub.