goharbor/harbor · error

failed to get adapter factory for registry type

Error message

failed to get adapter factory for registry type %s: %v

What it means

initialize in the replication flow wraps adp.GetFactory failure for a registry type: no adapter factory is registered for the source (or destination) registry type, typically an unsupported or unknown registry type in the replication policy.

Solutions

  1. Verify the registry type in the replication policy is supported by this Harbor version
  2. Check that the adapter for the registry type is registered at startup
  3. Correct the policy's source/destination registry configuration
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

	"path"
	"strings"

	repctlmodel "github.com/goharbor/harbor/src/controller/replication/model"
	"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
}

View on GitHub (pinned to 7b2fd08cc5)