{"record":{"id":"858164af342fb392","repo":"goharbor/harbor","slug":"bad-request-858164","errorCode":"BAD_REQUEST","errorMessage":"invalid scope: %s","messagePattern":"invalid scope: (.+?)","errorType":"validation","errorClass":"*errors.Error","httpStatus":400,"severity":"error","filePath":"src/server/v2.0/handler/label.go","lineNumber":99,"sourceCode":"\t\treturn lAPI.SendError(ctx, errors.New(nil).WithMessagef(\"label %d not found\", params.LabelID).WithCode(errors.NotFoundCode))\n\t}\n\n\tif err := lAPI.requireAccess(ctx, label, rbac.ActionRead); err != nil {\n\t\treturn lAPI.SendError(ctx, err)\n\t}\n\n\treturn operation.NewGetLabelByIDOK().WithPayload(model.NewLabel(label).ToSwagger())\n}\n\nfunc (lAPI *labelAPI) ListLabels(ctx context.Context, params operation.ListLabelsParams) middleware.Responder {\n\tquery, err := lAPI.BuildQuery(ctx, params.Q, params.Sort, params.Page, params.PageSize)\n\tif err != nil {\n\t\treturn lAPI.SendError(ctx, err)\n\t}\n\n\tscope := lib.StringValue(params.Scope)\n\tif scope != common.LabelScopeGlobal && scope != common.LabelScopeProject {\n\t\treturn lAPI.SendError(ctx, errors.New(nil).WithMessagef(\"invalid scope: %s\", scope).WithCode(errors.BadRequestCode))\n\t}\n\tquery.Keywords[\"Level\"] = common.LabelLevelUser\n\tquery.Keywords[\"Scope\"] = scope\n\tname := lib.StringValue(params.Name)\n\tif name != \"\" {\n\t\tquery.Keywords[\"name\"] = &q.FuzzyMatchValue{Value: name}\n\t}\n\tif scope == common.LabelScopeProject {\n\t\tpid := lib.Int64Value(params.ProjectID)\n\t\tif pid == 0 {\n\t\t\treturn lAPI.SendError(ctx, errors.BadRequestError(nil).WithMessage(\"must with project ID when to query project labels\"))\n\t\t}\n\t\tif err := lAPI.RequireProjectAccess(ctx, pid, rbac.ActionList, rbac.ResourceLabel); err != nil {\n\t\t\treturn lAPI.SendError(ctx, err)\n\t\t}\n\t\tquery.Keywords[\"ProjectID\"] = pid\n\t}\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/server/v2.0/handler/label.go#L81-L117","documentation":"Error \"invalid scope: %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/server/v2.0/handler/label.go:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}