goharbor/harbor · error

failed to create adapter for destination registry

Error message

failed to create adapter for destination registry %s: %v

What it means

initialize wraps dstFactory.Create failure: the destination registry adapter could not be created, typically invalid destination credentials, URL, or unsupported configuration in the replication policy.

Solutions

  1. Verify destination registry credentials, URL, and configuration
  2. Check the wrapped error for the adapter-specific cause
  3. Confirm the destination registry type's adapter supports the configured endpoint
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/controller/replication/flow/stage.go:51 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/05e6f26cea0eb21f. Report an issue: GitHub.

Appendix: source

Thrown at src/controller/replication/flow/stage.go:51

	// create the source registry adapter
	srcFactory, err := adp.GetFactory(policy.SrcRegistry.Type)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to get adapter factory for registry type %s: %v", policy.SrcRegistry.Type, err)
	}
	srcAdapter, err = srcFactory.Create(policy.SrcRegistry)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to create adapter for source registry %s: %v", policy.SrcRegistry.URL, err)
	}

	// create the destination registry adapter
	dstFactory, err := adp.GetFactory(policy.DestRegistry.Type)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to get adapter factory for registry type %s: %v", policy.DestRegistry.Type, err)
	}
	dstAdapter, err = dstFactory.Create(policy.DestRegistry)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to create adapter for destination registry %s: %v", policy.DestRegistry.URL, err)
	}
	log.Debug("replication flow initialization completed")
	return srcAdapter, dstAdapter, nil
}

// fetch resources from the source registry
func fetchResources(adapter adp.Adapter, policy *repctlmodel.Policy) ([]*model.Resource, error) {
	var resources []*model.Resource
	reg, ok := adapter.(adp.ArtifactRegistry)
	if !ok {
		return nil, fmt.Errorf("the adapter doesn't implement the ArtifactRegistry interface")
	}
	res, err := reg.FetchArtifacts(policy.Filters)
	if err != nil {
		return nil, fmt.Errorf("failed to fetch artifacts: %v", err)
	}
	resources = append(resources, res...)

View on GitHub (pinned to 7b2fd08cc5)