kubernetes/kops · error

invalid google cloud URL (unexpected zones): %q

Error message

invalid google cloud URL (unexpected zones): %q

What it means

While walking the tokenized path of a Google Cloud URL, a 'zones' segment was expected to be followed by a zone name, but the URL ended immediately. The parser had consumed tokens up to this point successfully; the input URL is simply too short / malformed after a 'zones' key.

Source

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

		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]
		case t == "zones":
			pos++
			if pos >= len(tokens) {
				return nil, fmt.Errorf("invalid google cloud URL (unexpected zones): %q", u)
			}
			parsed.Zone = tokens[pos]
		case t == "regions" && ((pos + 2) < len(tokens)):
			pos++
			if pos >= len(tokens) {
				return nil, fmt.Errorf("invalid google cloud URL (unexpected regions): %q", u)
			}
			parsed.Region = tokens[pos]
		case t == "global":
			parsed.Global = true
		default:
			parsed.Type = tokens[pos]
			pos++
			if pos >= len(tokens) {
				return nil, fmt.Errorf("invalid google cloud URL (no name): %q", u)
			}
			parsed.Name = tokens[pos]
			pos++

View on GitHub (pinned to 4c8573c808)

Defensive patterns

Strategy: validation

When it happens

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