goharbor/harbor · error

protocol should be or , but current setting is

Error message

protocol should be %s or %s, but current setting is %s

What it means

Validation in Configuration.validate: the configured serving protocol is neither the supported HTTP nor HTTPS value, so the job service configuration is rejected.

Solutions

  1. Set protocol to 'http' or 'https' in the jobservice configuration
  2. Check env/yaml for typos or stray whitespace in the protocol value
  3. Re-run configuration loading after correction
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/jobservice/config/config.go:309 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/db29ec2b3046ea3a. Report an issue: GitHub.

Appendix: source

Thrown at src/jobservice/config/config.go:309

		if !utils.IsEmptyStr(it) {
			if c.PoolConfig.RedisPoolCfg == nil {
				c.PoolConfig.RedisPoolCfg = &RedisPoolConfig{}
			}
			v, err := strconv.Atoi(it)
			if err != nil {
				log.Warningf("Invalid idle timeout second: %s, will use 0 instead", it)
			} else {
				c.PoolConfig.RedisPoolCfg.IdleTimeoutSecond = int64(v)
			}
		}
	}
}

// Check if the configurations are valid settings.
func (c *Configuration) validate() error {
	if c.Protocol != JobServiceProtocolHTTPS &&
		c.Protocol != JobServiceProtocolHTTP {
		return fmt.Errorf("protocol should be %s or %s, but current setting is %s",
			JobServiceProtocolHTTP,
			JobServiceProtocolHTTPS,
			c.Protocol)
	}

	if !utils.IsValidPort(c.Port) {
		return fmt.Errorf("port number should be a none zero integer and less or equal 65535, but current is %d", c.Port)
	}

	if c.Protocol == JobServiceProtocolHTTPS {
		if c.HTTPSConfig == nil {
			return fmt.Errorf("certificate must be configured if serve with protocol %s", c.Protocol)
		}

		if utils.IsEmptyStr(c.HTTPSConfig.Cert) ||
			!utils.FileExists(c.HTTPSConfig.Cert) ||
			utils.IsEmptyStr(c.HTTPSConfig.Key) ||
			!utils.FileExists(c.HTTPSConfig.Key) {

View on GitHub (pinned to 7b2fd08cc5)