goharbor/harbor · error

single active replication is not allowed for event_based…

Error message

single active replication is not allowed for event_based triggers

What it means

Policy-shape guard in CreateReplicationPolicy: the request enables single_active_replication while the policy's trigger type is event_based. Single-active semantics conflict with event-based triggering (events may arrive at any time and cannot be serialized through one active execution), so the combination is rejected at creation time.

Solutions

  1. Either disable single_active_replication for event-based triggered policies, or switch the trigger type to scheduled/manual
  2. Review the trigger settings block of the policy payload for consistency before submitting
  3. Consult the replication policy documentation for which trigger types support single active mode
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/server/v2.0/handler/replication.go:119 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/77f8834e4c5de700. Report an issue: GitHub.

Appendix: source

Thrown at src/server/v2.0/handler/replication.go:119

				Cron: params.Policy.Trigger.TriggerSettings.Cron,
			}
		}
	}
	if params.Policy.Speed != nil {
		if *params.Policy.Speed < 0 {
			*params.Policy.Speed = 0
		}
		policy.Speed = *params.Policy.Speed
	}

	if params.Policy.CopyByChunk != nil {
		policy.CopyByChunk = *params.Policy.CopyByChunk
	}

	if params.Policy.SingleActiveReplication != nil {
		// Validate and assign SingleActiveReplication only for non-event_based triggers
		if params.Policy.Trigger != nil && params.Policy.Trigger.Type == model.TriggerTypeEventBased && *params.Policy.SingleActiveReplication {
			return r.SendError(ctx, fmt.Errorf("single active replication is not allowed for event_based triggers"))
		}
		policy.SingleActiveReplication = *params.Policy.SingleActiveReplication
	}

	id, err := r.ctl.CreatePolicy(ctx, policy)
	if err != nil {
		return r.SendError(ctx, err)
	}
	location := fmt.Sprintf("%s/%d", strings.TrimSuffix(params.HTTPRequest.URL.Path, "/"), id)
	return operation.NewCreateReplicationPolicyCreated().WithLocation(location)
}

func (r *replicationAPI) UpdateReplicationPolicy(ctx context.Context, params operation.UpdateReplicationPolicyParams) middleware.Responder {
	if err := r.RequireSystemAccess(ctx, rbac.ActionUpdate, rbac.ResourceReplicationPolicy); err != nil {
		return r.SendError(ctx, err)
	}
	policy := &repctlmodel.Policy{
		ID:                params.ID,

View on GitHub (pinned to 7b2fd08cc5)