goharbor/harbor · error · *errors.Error

BAD_REQUEST

BAD_REQUEST

Error message

the retention_id in the request's payload when updating a project should be omitted, alternatively passing the one that has already been associated to this project

What it means

Error "the retention_id in the request's payload when updating a project should be omitted, alternatively passing the one that has already been associated to this project" thrown in goharbor/harbor.

Source

Thrown at src/server/v2.0/handler/project.go:601

	if params.Project.Metadata != nil && p.IsProxy() {
		params.Project.Metadata.EnableContentTrust = nil
		if err := validateProxyCacheRepositoryFilter(params.Project.Metadata); err != nil {
			return a.SendError(ctx, err)
		}
	}
	if err := lib.JSONCopy(&p.Metadata, params.Project.Metadata); err != nil {
		log.Warningf("failed to call JSONCopy on project metadata when UpdateProject, error: %v", err)
	}

	// validate retention_id
	if ridParam, ok := p.Metadata["retention_id"]; ok {
		md, err := a.metadataMgr.Get(ctx, p.ProjectID)
		if err != nil {
			return a.SendError(ctx, err)
		}
		if rid, ok := md["retention_id"]; !ok || rid != ridParam {
			errMsg := "the retention_id in the request's payload when updating a project should be omitted, alternatively passing the one that has already been associated to this project"
			return a.SendError(ctx, errors.New(nil).WithMessage(errMsg).WithCode(errors.BadRequestCode))
		}
	}

	if err := a.projectCtl.Update(ctx, p); err != nil {
		return a.SendError(ctx, err)
	}

	return operation.NewUpdateProjectOK()
}

func (a *projectAPI) GetScannerOfProject(ctx context.Context, params operation.GetScannerOfProjectParams) middleware.Responder {
	if err := a.RequireAuthenticated(ctx); err != nil {
		return a.SendError(ctx, err)
	}

	projectNameOrID := parseProjectNameOrID(params.ProjectNameOrID, params.XIsResourceName)
	if err := a.RequireProjectAccess(ctx, projectNameOrID, rbac.ActionRead, rbac.ResourceScanner); err != nil {
		return a.SendError(ctx, err)

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/server/v2.0/handler/project.go:601 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/bc3080bcdb5e3bb0. Report an issue: GitHub.