kubernetes/kops · error

invalid google cloud URL (not compute): %q

Error message

invalid google cloud URL (not compute): %q

What it means

Third-stage parse guard in ParseGoogleCloudURL: host is correct but the path is too short to include an API version, or the fourth token is not 'compute'. Fires for non-compute googleapis URLs (e.g. storage or DNS self-links) passed to the compute URL parser.

Source

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

	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)
		}
		t := tokens[pos]
		switch {
		case t == "projects":
			pos++

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Pass a compute API self-link (…/compute/v1/…)
  2. Verify the resource reference is a compute resource
  3. Correct the URL source and re-run
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gce/gce_url.go:67 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/e0561ffc09fe0620. Report an issue: GitHub.