goharbor/harbor · error

malformed registry URL

Error message

malformed registry URL: %w

What it means

Wrapped error in PreheatImage.Validate: url.Parse failed on the image's registry URL, so the preheat destination address is malformed; the underlying parse error is embedded.

Solutions

  1. Provide a well-formed registry URL, e.g. 'https://registry.example.com'
  2. Check the URL construction in the preheat policy/params
  3. Handle the wrapped error for the underlying parse cause
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/pkg/p2p/preheat/provider/preheat_image.go:96 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/b209bffac151da03. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/p2p/preheat/provider/preheat_image.go:96

}

// Validate PreheatImage
func (img *PreheatImage) Validate() error {
	if !slices.Contains(SupportedTypes, img.Type) {
		return fmt.Errorf("unsupported type '%s'", img.Type)
	}

	if len(img.ImageName) == 0 || len(img.Tag) == 0 {
		return errors.New("missing image repository or tag")
	}

	if len(img.Headers) == 0 {
		return errors.New("missing required headers")
	}

	_, err := url.Parse(img.URL)
	if err != nil {
		return fmt.Errorf("malformed registry URL: %w", err)
	}

	return nil
}

View on GitHub (pinned to 7b2fd08cc5)