kubernetes/kops · error

invalid google cloud URL (schema / host): %q

Error message

invalid google cloud URL (schema / host): %q

What it means

Second-stage parse guard in ParseGoogleCloudURL: token count is fine but the scheme/host tokens are not 'https:', '', 'www.googleapis.com'. Fires when a URL points at a different host or lacks the https scheme (e.g. http://, googleapis.cn, or arbitrary hosts).

Source

Thrown at upup/pkg/fi/cloudup/gce/gce_url.go:63

	}
	if u.Region != "" {
		url += "regions/" + u.Region + "/"
	}
	if u.Zone != "" {
		url += "zones/" + u.Zone + "/"
	}
	url += u.Type + "/" + u.Name
	return url
}

func ParseGoogleCloudURL(u string) (*GoogleCloudURL, error) {
	tokens := strings.Split(u, "/")
	if len(tokens) < 3 {
		return nil, fmt.Errorf("invalid google cloud URL (token count): %q", u)
	}

	if tokens[0] != "https:" || tokens[1] != "" || tokens[2] != "www.googleapis.com" {
		return nil, fmt.Errorf("invalid google cloud URL (schema / host): %q", u)
	}

	if len(tokens) < 5 || tokens[3] != "compute" {
		return nil, fmt.Errorf("invalid google cloud URL (not compute): %q", u)
	}

	if tokens[4] != "v1" && tokens[4] != "beta" {
		return nil, fmt.Errorf("invalid google cloud URL (not compute/v1 or compute/beta): %q", u)
	}

	parsed := &GoogleCloudURL{
		Version: tokens[4],
	}
	pos := 5
	for {
		if pos >= len(tokens) {
			return nil, fmt.Errorf("invalid google cloud URL (unexpected end): %q", u)
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use the canonical https://www.googleapis.com self-link form
  2. Check for edited/truncated URLs
  3. Fix the value at its source and re-run
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gce/gce_url.go:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/6d421a11e9bbcff3. Report an issue: GitHub.