goharbor/harbor · error

unsupported candidate kind

Error message

unsupported candidate kind: %s

What it means

Returned by Delete when candidate.Kind is not 'image' (chart deletion is commented out). This is a default-branch guard in the kind switch: the retention deletion path only knows how to delete image artifacts via DeleteArtifact, so any other candidate kind is rejected before attempting deletion.

Solutions

  1. Ensure retention deletion is only invoked for image candidates
  2. Extend the switch to handle additional kinds if needed
  3. Filter candidates by kind before scheduling deletion
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/retention/dep/client.go:208 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/d5d38a16a3ded940. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/retention/dep/client.go:208

	default:
		return fmt.Errorf("unsupported repository kind: %s", repo.Kind)
	}
}

// Deletes the specified candidate
func (bc *basicClient) Delete(candidate *selector.Candidate) error {
	if candidate == nil {
		return errors.New("candidate is nil")
	}
	switch candidate.Kind {
	case selector.Image:
		return bc.coreClient.DeleteArtifact(candidate.Namespace, candidate.Repository, candidate.Digest)
	/*
		case art.Chart:
			return bc.coreClient.DeleteChart(candidate.Namespace, candidate.Repository, candidate.Tag)
	*/
	default:
		return fmt.Errorf("unsupported candidate kind: %s", candidate.Kind)
	}
}

View on GitHub (pinned to 7b2fd08cc5)