kubernetes/kops · error

unexpected format for ServiceAccount email %q

Error message

unexpected format for ServiceAccount email %q

What it means

Format-validation guard in SplitServiceAccountEmail: the email does not match <accountID>@<projectID>.iam.gserviceaccount.com (or lacks an @), so it cannot be split into account and project IDs. Fires when a misconfigured service account email reaches GCE task rendering/lookup.

Source

Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:440

	return tokenInfo, nil
}

// SplitServiceAccountEmail splits service account email
func SplitServiceAccountEmail(email string) (string, string, error) {
	accountID := ""
	projectID := ""

	tokens := strings.Split(email, "@")
	if len(tokens) == 2 {
		accountID = tokens[0]
		if strings.HasSuffix(tokens[1], ".iam.gserviceaccount.com") {
			projectID = strings.TrimSuffix(tokens[1], ".iam.gserviceaccount.com")
		}
	}

	if accountID == "" || projectID == "" {
		return "", "", fmt.Errorf("unexpected format for ServiceAccount email %q", email)
	}
	return accountID, projectID, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Correct the service account email in the cluster/task spec
  2. Copy the exact email from the GCP IAM console
  3. Ensure it ends with .iam.gserviceaccount.com
Defensive patterns

Strategy: validation

When it happens

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