goharbor/harbor · error

fail to match tag pattern, error=

Error message

fail to match tag pattern, error=%w

What it means

Returned inside a concurrent FetchArtifacts task when util.Match fails while evaluating the tag filter pattern against a candidate tag. It wraps the error with %w; the fault is an invalid tag filter pattern (regexp) configured in the replication filters, not the tag data itself.

Solutions

  1. Correct the tag filter pattern in the replication rule to a valid Go regexp
  2. Validate the pattern when the rule is created
  3. Escape regex metacharacters for literal tag matching
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/reg/adapter/volcenginecr/artifact_registry.go:167 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/862fc2ce57563f26. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/reg/adapter/volcenginecr/artifact_registry.go:167

	for idx, repo := range nsRepos {
		i := idx
		nsRepo := repo
		runner.AddTask(func() error {
			repoArr := strings.SplitN(nsRepo, "/", 2)
			// note list tag don't tell different oci types now
			candidateTags, err := a.listAllTags(repoArr[0], repoArr[1])
			if err != nil {
				log.Error("fail to list all tags", "nsRepo", nsRepo)
				return fmt.Errorf("volcengineCR fail to list all tags %w", err)
			}

			tags := make([]string, 0)
			if tagsPattern != "" {
				for _, candidateTag := range candidateTags {
					ok, err := util.Match(tagsPattern, candidateTag)
					if err != nil {
						return fmt.Errorf("fail to match tag pattern, error=%w", err)
					}
					if ok {
						tags = append(tags, candidateTag)
					}
				}
			} else {
				tags = candidateTags
			}

			log.Debug("filter tags")

			if len(tags) > 0 {
				rawResources[i] = &model.Resource{
					Type:     model.ResourceTypeImage,
					Registry: a.registry,
					Metadata: &model.ResourceMetadata{
						Repository: &model.Repository{
							Name: nsRepo,

View on GitHub (pinned to 7b2fd08cc5)