goharbor/harbor · error

bad _REDIS_URL_HARBOR

Error message

bad _REDIS_URL_HARBOR

What it means

Fatal configuration error at harbor-core startup: the Redis URL for the harbor business database (_REDIS_URL_HARBOR, or _REDIS_URL_CORE when the former is unset) fails url.Parse. The panic fires during cache initialization because an unparseable Redis URL cannot back the Harbor cache layer.

Solutions

  1. Correct _REDIS_URL_HARBOR to a valid redis:// URL (user:pass@host:port/db)
  2. If it is unset, fix _REDIS_URL_CORE instead, since it is used as the fallback
  3. Redeploy/restart the core container once the environment variable is valid
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/main.go:169 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/37b9fca401bfa89b. Report an issue: GitHub.

Appendix: source

Thrown at src/core/main.go:169

	if len(redisCoreURL) > 0 {
		_, err := url.Parse(redisCoreURL)
		if err != nil {
			panic("bad _REDIS_URL_CORE")
		}
		// configure the beego session redis
		web.BConfig.WebConfig.Session.SessionProvider = session.HarborProviderName
		web.BConfig.WebConfig.Session.SessionProviderConfig = redisCoreURL
	}

	log.Info("initializing cache ...")
	// the harbor db used for harbor business, use core db if not specified
	redisHarborURL := os.Getenv("_REDIS_URL_HARBOR")
	if redisHarborURL == "" {
		redisHarborURL = redisCoreURL
	}
	u, err := url.Parse(redisHarborURL)
	if err != nil {
		panic("bad _REDIS_URL_HARBOR")
	}
	if err := cache.Initialize(u.Scheme, redisHarborURL); err != nil {
		log.Fatalf("failed to initialize cache: %v", err)
	}
	// when config/db init function is called, the cache is not ready,
	// enable config cache explicitly when the cache is ready
	dbCfg.EnableConfigCache()

	web.AddTemplateExt("htm")

	log.Info("initializing configurations...")
	config.Init()
	log.Info("configurations initialization completed")

	// default beego max memory and max upload size is 128GB, consider from some AI related image would be large,
	// also support customize it from the environment variables if the default value cannot satisfy some scenarios.
	web.BConfig.MaxMemory = config.GetBeegoMaxMemoryBytes()
	web.BConfig.MaxUploadSize = config.GetBeegoMaxUploadSizeBytes()

View on GitHub (pinned to 7b2fd08cc5)