semaphoreui/semaphore · error

panic(err)

Error message

panic(err)

What it means

Panics from ConfigInit in util/config.go when the configured web host (Config.WebHost, e.g. the public URL of the Semaphore UI) cannot be parsed by url.Parse. It is a fail-fast guard on startup configuration: the URL is needed to build absolute links and API references, so an unparseable value (control characters, invalid percent-encoding, a malformed bracketed host) aborts boot instead of producing broken URLs later.

Solutions

  1. Correct the web_host value in the config file / SEMAPHORE_WEB_HOST env var to a full valid URL such as https://semaphore.example.com
  2. Check for stray whitespace, quotes, or unescaped special characters in the configured URL
  3. Validate the URL with a parser before deploying the config
  4. If no public URL is needed, leave web_host empty so the field is skipped
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at util/config.go:929 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07). Data as JSON: /api/errors/8f2293e08ad256d0. Report an issue: GitHub.

Appendix: source

Thrown at util/config.go:929

		if err := SetNoNewPrivs(); err != nil {
			panic(fmt.Errorf("failed to set no_new_privs: %w", err))
		}
	}

	var encryption []byte

	hash, _ := base64.StdEncoding.DecodeString(Config.CookieHash)
	if len(Config.CookieEncryption) > 0 {
		encryption, _ = base64.StdEncoding.DecodeString(Config.CookieEncryption)
	}

	Cookie = securecookie.New(hash, encryption)

	if Config.WebHost != "" {
		var err error
		WebHostURL, err = url.Parse(Config.WebHost)
		if err != nil {
			panic(err)
		}

		if len(WebHostURL.String()) == 0 {
			WebHostURL = nil
		}
	} else {
		WebHostURL = nil
	}

	if Config.Runner.Token != "" && Config.Runner.TokenFile != "" {
		panic("SEMAPHORE_RUNNER_TOKEN and SEMAPHORE_RUNNER_TOKEN_FILE are mutually exclusive")
	}

	if Config.Runner.TokenFile != "" {
		runnerTokenBytes, err := os.ReadFile(Config.Runner.TokenFile)
		if err == nil {
			Config.Runner.Token = strings.TrimSpace(string(runnerTokenBytes))
		}

View on GitHub (pinned to 1774ccb71a)