kubernetes/kops · error

invalid google cloud URL (not compute/v1 or compute/beta): %

Error message

invalid google cloud URL (not compute/v1 or compute/beta): %q

What it means

Version-stage parse guard in ParseGoogleCloudURL: the API version token is neither 'v1' nor 'beta', which are the only compute API versions the parser accepts. Fires for alpha/other-version self-links or paths with an unexpected segment in that position.

Source

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

	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++
			if pos >= len(tokens) {
				return nil, fmt.Errorf("invalid google cloud URL (unexpected projects): %q", u)
			}
			parsed.Project = tokens[pos]

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use a v1 (or beta) compute self-link
  2. Check for manually constructed URLs with wrong version segments
  3. Report if a legitimately needed API version is unsupported
Defensive patterns

Strategy: validation

When it happens

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