goharbor/harbor · error · Exception

Only can have one trace exporter at a time

Error message

Only can have one trace exporter at a time

What it means

ScanRequest.Validate requires a Registry with a non-empty URL so the adapter knows where to pull the artifact from. 'scan request: invalid registry' means Registry is nil or its URL is the empty string; the request cannot be fulfilled without a reachable registry.

Source

Thrown at make/photon/prepare/models.py:192

            raise Exception('Trace url path not set')


class Trace:
    def __init__(self, config: dict):
        self.enabled = config.get('enabled') or False
        self.sample_rate = config.get('sample_rate', 1)
        self.namespace = config.get('namespace') or ''
        self.jaeger = JaegerExporter(config.get('jaeger'))
        self.otel = OtelExporter(config.get('otel'))
        self.attributes = config.get('attributes') or {}

    def validate(self):
        if not self.enabled:
            return
        if not self.jaeger.enabled and not self.otel.enabled:
            raise Exception('Trace enabled but no trace exporter set')
        elif self.jaeger.enabled and self.otel.enabled:
            raise Exception('Only can have one trace exporter at a time')
        elif self.jaeger.enabled:
            self.jaeger.validate()
        elif self.otel.enabled:
            self.otel.validate()


class PurgeUpload:
    def __init__(self, config: dict):
        if not config:
            self.enabled = False
        self.enabled = config.get('enabled')
        self.age = config.get('age') or '168h'
        self.interval = config.get('interval') or '24h'
        self.dryrun = config.get('dryrun') or False
        return

    def validate(self):
        if not self.enabled:

View on GitHub (pinned to 7b2fd08cc5)

Solutions

  1. Ensure the scan request JSON carries a non-empty registry.url (e.g. https://registry:5000)
  2. Populate the registry from your registry configuration before validating
  3. Return 400 with field-level detail so the caller knows which field is missing

Example fix

// before
req := &v1.ScanRequest{Artifact: art} // Registry left nil
err := req.Validate()

// after
req := &v1.ScanRequest{
    Registry: &v1.Registry{URL: cfg.RegistryURL},
    Artifact: art,
}
err := req.Validate()
Defensive patterns

Strategy: validation

Validate before calling

if req.Registry == nil || req.Registry.URL == "" {
    return errors.New("scan request missing registry.url")
}
return req.Validate()

Try / catch

if err := req.Validate(); err != nil {
    if strings.Contains(err.Error(), "invalid registry") {
        return errors.New("fill registry.url (e.g. from registry config) before submitting")
    }
    return err
}

Prevention

When it happens

Trigger: req.Validate() on a payload where the registry object or registry.url field is missing — typically the enqueuing component did not fill the registry URL when building the request.

Common situations: Registry configuration missing in the component that creates scan requests; hand-crafted API calls omitting registry.url; environments where the internal registry address is injected conditionally.

Related errors


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