goharbor/harbor · error

failed to create adapter for source registry

Error message

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

What it means

initialize wraps srcFactory.Create failure: the source registry adapter could not be instantiated for the given registry model, usually due to invalid credentials, bad URL, or adapter-level configuration errors.

Solutions

  1. Verify source registry credentials, URL, and endpoint configuration
  2. Check the wrapped error for the adapter's specific failure cause
  3. Test connectivity to the source registry from Harbor
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

	"github.com/goharbor/harbor/src/lib/errors"
	"github.com/goharbor/harbor/src/lib/log"
	adp "github.com/goharbor/harbor/src/pkg/reg/adapter"
	"github.com/goharbor/harbor/src/pkg/reg/model"
)

// get/create the source registry, destination registry, source adapter and destination adapter
func initialize(policy *repctlmodel.Policy) (adp.Adapter, adp.Adapter, error) {
	var srcAdapter, dstAdapter adp.Adapter
	var err error

	// 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

View on GitHub (pinned to 7b2fd08cc5)