kubernetes/kops · error

invalid google cloud URL (unexpected projects): %q

Error message

invalid google cloud URL (unexpected projects): %q

What it means

ParseGoogleCloudURL tokenizes a compute resource self-link; when it encounters the 'projects' segment it requires a following token for the project ID. This guard fires when a self-link ends abruptly after 'projects/', i.e. a truncated or malformed Google Cloud URL.

Source

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

	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]
		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]

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Include the project ID after 'projects/' in the URL
  2. Fix truncated or hand-edited self-links
Defensive patterns

Strategy: validation

When it happens

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