goharbor/harbor · error

the adapter doesn't implement the ArtifactRegistry interface

Error message

the adapter doesn't implement the ArtifactRegistry interface

What it means

Type-guard failure in fetchResources: the source adapter does not implement the ArtifactRegistry interface, so artifact-level replication cannot be performed with this registry type. A programming/capability mismatch, not a runtime condition.

Solutions

  1. Use a registry type whose adapter supports artifact-level replication
  2. Switch the replication policy to a mode appropriate for the adapter's capabilities
  3. Update or fix the adapter to implement ArtifactRegistry if it should support it
Defensive patterns

Strategy: type-guard

When it happens

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

Appendix: source

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

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

	log.Debug("fetch resources from the source registry completed")
	return resources, nil
}

// assemble the source resources by filling the registry information
func assembleSourceResources(resources []*model.Resource,
	policy *repctlmodel.Policy) []*model.Resource {
	for _, resource := range resources {
		resource.Registry = policy.SrcRegistry
	}
	log.Debug("assemble the source resources completed")

View on GitHub (pinned to 7b2fd08cc5)