googleapis/mcp-toolbox · warning

invalid web_server_url format: %q

Error message

invalid web_server_url format: %q

What it means

After fetching web_server_url from the Looker versions endpoint, the value is parsed with url.Parse and must be an absolute http/https URL with a host. Values like relative paths, missing scheme, or whitespace fail validation and this error is stored as lastFetchErr; a stale/default fallback host URL is used with a warning.

Source

Thrown at internal/sources/looker/looker.go:368

			s.lastFetchFailed = true
			s.lastFetchTime = time.Now()
			s.lastFetchErr = fetchErr
			// DO NOT overwrite s.cachedHostURL on transient errors; keep the stale valid URL for stale fallbacks
			s.hostURLMu.Unlock()

			if err != nil {
				logger.WarnContext(ctx, fmt.Sprintf("unable to retrieve host_url via versions, using stale/default fallback: %v", err))
			} else {
				logger.DebugContext(ctx, "versions web_server_url is empty, using stale/default fallback")
			}
			return "", fetchErr
		}

		// Validate the retrieved host_url is a valid absolute HTTP/HTTPS URL
		valURL := *versionInfo.WebServerUrl
		u, err := url.Parse(valURL)
		if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
			parseErr := fmt.Errorf("invalid web_server_url format: %q", valURL)
			s.hostURLMu.Lock()
			s.lastFetchFailed = true
			s.lastFetchTime = time.Now()
			s.lastFetchErr = parseErr
			s.hostURLMu.Unlock()
			logger.WarnContext(ctx, fmt.Sprintf("invalid host_url setting retrieved %q, using stale/default fallback: %v", valURL, err))
			return "", parseErr
		}

		resolvedURL := strings.TrimSuffix(valURL, "/")

		s.hostURLMu.Lock()
		s.cachedHostURL = resolvedURL
		s.lastFetchTime = time.Now()
		s.lastFetchFailed = false
		s.lastFetchErr = nil
		s.hostURLMu.Unlock()

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Fix the Web Server URL in Looker Admin settings to a fully-qualified https:// URL (e.g. https://mycompany.looker.com)
  2. Retry after fixing — the warning path keeps serving the stale URL until a good fetch succeeds
  3. If a custom domain was recently changed, allow DNS/TLS to settle and verify the URL resolves

Example fix

// before (Looker admin setting)
web_server_url: mycompany.looker.com
// after
web_server_url: https://mycompany.looker.com
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.Parse(webServerURL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
    return fmt.Errorf("looker web_server_url must be absolute http(s): %q", webServerURL)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "invalid web_server_url format") {
    // fix Looker admin setting; meanwhile stale URL is used
    logger.Warn("looker web_server_url invalid; using fallback")
}

Prevention

When it happens

Trigger: versionInfo.WebServerUrl parses to a URL with scheme other than http/https, or an empty Host (e.g. "my.looker.com" without https://, or "/relative/path").

Common situations: Looker web_server_url configured without the https:// scheme; misconfigured reverse proxies; typo in the Looker admin setting producing a malformed URL.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/4721078469a79bce. Report an issue: GitHub.