goharbor/harbor · error · *errors.Error

NOT_FOUND

NOT_FOUND

Error message

label %d not found

What it means

Error "label %d not found" thrown in goharbor/harbor.

Source

Thrown at src/server/v2.0/handler/label.go:81

		return lAPI.SendError(ctx, err)
	}

	id, err := lAPI.labelMgr.Create(ctx, label)
	if err != nil {
		return lAPI.SendError(ctx, err)
	}

	location := fmt.Sprintf("%s/%d", strings.TrimSuffix(params.HTTPRequest.URL.Path, "/"), id)
	return operation.NewCreateLabelCreated().WithLocation(location)
}

func (lAPI *labelAPI) GetLabelByID(ctx context.Context, params operation.GetLabelByIDParams) middleware.Responder {
	label, err := lAPI.labelMgr.Get(ctx, params.LabelID)
	if err != nil {
		return lAPI.SendError(ctx, err)
	}
	if label == nil || label.Deleted {
		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))

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/server/v2.0/handler/label.go:81 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/34618cf56813e6cb. Report an issue: GitHub.