goharbor/harbor · error · *errors.Error
BAD_REQUEST
BAD_REQUEST
Error message
invalid scope: %s
What it means
Error "invalid scope: %s" thrown in goharbor/harbor.
Source
Thrown at src/server/v2.0/handler/label.go:99
return lAPI.SendError(ctx, errors.New(nil).WithMessagef("label %d not found", params.LabelID).WithCode(errors.NotFoundCode))
}
if err := lAPI.requireAccess(ctx, label, rbac.ActionRead); err != nil {
return lAPI.SendError(ctx, err)
}
return operation.NewGetLabelByIDOK().WithPayload(model.NewLabel(label).ToSwagger())
}
func (lAPI *labelAPI) ListLabels(ctx context.Context, params operation.ListLabelsParams) middleware.Responder {
query, err := lAPI.BuildQuery(ctx, params.Q, params.Sort, params.Page, params.PageSize)
if err != nil {
return lAPI.SendError(ctx, err)
}
scope := lib.StringValue(params.Scope)
if scope != common.LabelScopeGlobal && scope != common.LabelScopeProject {
return lAPI.SendError(ctx, errors.New(nil).WithMessagef("invalid scope: %s", scope).WithCode(errors.BadRequestCode))
}
query.Keywords["Level"] = common.LabelLevelUser
query.Keywords["Scope"] = scope
name := lib.StringValue(params.Name)
if name != "" {
query.Keywords["name"] = &q.FuzzyMatchValue{Value: name}
}
if scope == common.LabelScopeProject {
pid := lib.Int64Value(params.ProjectID)
if pid == 0 {
return lAPI.SendError(ctx, errors.BadRequestError(nil).WithMessage("must with project ID when to query project labels"))
}
if err := lAPI.RequireProjectAccess(ctx, pid, rbac.ActionList, rbac.ResourceLabel); err != nil {
return lAPI.SendError(ctx, err)
}
query.Keywords["ProjectID"] = pid
}
View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/server/v2.0/handler/label.go:99 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/858164af342fb392.
Report an issue: GitHub.