kubernetes/kops · error
invalid google cloud URL (token count): %q
Error message
invalid google cloud URL (token count): %q
What it means
First-stage parse guard in ParseGoogleCloudURL: splitting the URL on '/' yields fewer than three tokens, so it cannot even contain scheme+host. Fires on drastically malformed self-link strings (empty, relative paths, garbage).
Source
Thrown at upup/pkg/fi/cloudup/gce/gce_url.go:59
url += "projects/" + u.Project + "/"
}
if u.Global {
url += "global/"
}
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 := 5View on GitHub (pinned to 4c8573c808)
Solutions
- Provide a full GCE self-link URL (https://www.googleapis.com/...)
- Check where the malformed value came from (resource config vs API response)
- Fix the source of the URL and re-run
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/gce/gce_url.go:59 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/4876485229c6e1a0.
Report an issue: GitHub.