goharbor/harbor · error · errors.Error

NOT_FOUND

NOT_FOUND

Error message

retention policy is not found

What it means

Error "retention policy is not found" thrown in goharbor/harbor.

Source

Thrown at src/server/v2.0/handler/retention.go:298

	eid, err := r.retentionCtl.TriggerRetentionExec(ctx, params.ID, task.ExecutionTriggerManual, params.Body.DryRun)
	if err != nil {
		return r.SendError(ctx, err)
	}

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

func (r *retentionAPI) OperateRetentionExecution(ctx context.Context, params operation.OperateRetentionExecutionParams) middleware.Responder {
	if params.Body.Action != "stop" {
		return r.SendError(ctx, errors.BadRequestError((fmt.Errorf("action should be 'stop'"))))
	}
	p, err := r.retentionCtl.GetRetention(ctx, params.ID)
	if err != nil {
		return r.SendError(ctx, errors.BadRequestError(err))
	}
	if p == nil {
		return r.SendError(ctx, errors.New("retention policy is not found").WithCode(errors.NotFoundCode))
	}
	if err := r.requireAccess(ctx, p, rbac.ActionUpdate); err != nil {
		return r.SendError(ctx, err)
	}
	if err := r.requirePolicyAccess(ctx, p); err != nil {
		return r.SendError(ctx, err)
	}
	if err := r.requireExecutionInProject(ctx, p, params.Eid); err != nil {
		return r.SendError(ctx, err)
	}
	if err := r.retentionCtl.OperateRetentionExec(ctx, params.Eid, params.Body.Action); err != nil {
		return r.SendError(ctx, err)
	}
	return operation.NewOperateRetentionExecutionOK()
}

func (r *retentionAPI) ListRetentionExecutions(ctx context.Context, params operation.ListRetentionExecutionsParams) middleware.Responder {
	query, err := r.BuildQuery(ctx, nil, nil, params.Page, params.PageSize)

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/server/v2.0/handler/retention.go:298 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/4f100fe4ecb77500. Report an issue: GitHub.