goharbor/harbor · error

bad web hook URL

Error message

bad web hook URL: %s

What it means

Policy.Validate found a non-empty WebHookURL that failed utils.IsValidURL, meaning the periodic job policy carries a webhook endpoint that is not a parseable absolute URL; the offending URL is included in the message.

Solutions

  1. Correct the webhook URL in the policy payload to a valid absolute URL (scheme + host)
  2. Omit the WebHookURL field if no webhook callback is needed
  3. Add client-side URL validation before submitting the policy via the jobservice API
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/jobservice/period/policy_store.go:64 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/439683bbea05f766. Report an issue: GitHub.

Appendix: source

Thrown at src/jobservice/period/policy_store.go:64

// DeSerialize the raw json to policy.
func (p *Policy) DeSerialize(rawJSON []byte) error {
	return json.Unmarshal(rawJSON, p)
}

// Validate the policy
func (p *Policy) Validate() error {
	if utils.IsEmptyStr(p.ID) {
		return errors.New("missing ID in the periodic job policy object")
	}

	if utils.IsEmptyStr(p.JobName) {
		return errors.New("missing job name in the periodic job policy object")
	}

	if !utils.IsEmptyStr(p.WebHookURL) {
		if !utils.IsValidURL(p.WebHookURL) {
			return fmt.Errorf("bad web hook URL: %s", p.WebHookURL)
		}
	}

	if _, err := comUtils.CronParser().Parse(p.CronSpec); err != nil {
		return err
	}

	return nil
}

type policyWithScore struct {
	RawData []byte
	Score   int64
}

// Load all the policies from the backend storage.
func Load(namespace string, conn redis.Conn) ([]*Policy, error) {
	bytes, err := redis.Values(conn.Do("ZRANGE", rds.KeyPeriodicPolicy(namespace), 0, -1, "WITHSCORES"))

View on GitHub (pinned to 7b2fd08cc5)