kubernetes/kops · error
error parsing source image URL: %v
Error message
error parsing source image URL: %v
What it means
While reconstructing the actual state of a matching GCE instance template, Find calls ShortenImageURL to convert the template's boot disk SourceImage URL back into the short 'project/image' form used in the kOps spec. If the URL cannot be parsed (or the image can't be attributed to a project), the error is wrapped and returned.
Source
Thrown at upup/pkg/fi/cloudup/gcetasks/instancetemplate.go:133
continue
}
if !matches(expected, r) {
continue
}
actual := &InstanceTemplate{}
p := r.Properties
actual.Tags = append(actual.Tags, p.Tags.Items...)
actual.Labels = p.Labels
actual.MachineType = new(lastComponent(p.MachineType))
actual.CanIPForward = &p.CanIpForward
bootDiskImage, err := ShortenImageURL(cloud.Project(), p.Disks[0].InitializeParams.SourceImage)
if err != nil {
return nil, fmt.Errorf("error parsing source image URL: %v", err)
}
actual.BootDiskImage = new(bootDiskImage)
actual.BootDiskType = &p.Disks[0].InitializeParams.DiskType
actual.BootDiskSizeGB = &p.Disks[0].InitializeParams.DiskSizeGb
if p.Disks[0].InitializeParams.ProvisionedIops > 0 {
actual.BootDiskIOPS = &p.Disks[0].InitializeParams.ProvisionedIops
}
if p.Disks[0].InitializeParams.ProvisionedThroughput > 0 {
actual.BootDiskThroughput = &p.Disks[0].InitializeParams.ProvisionedThroughput
}
if p.Scheduling != nil {
actual.Preemptible = &p.Scheduling.Preemptible
actual.GCPProvisioningModel = &p.Scheduling.ProvisioningModel
}
if len(p.NetworkInterfaces) != 0 {
ni := p.NetworkInterfaces[0]
actual.Network = &Network{Name: new(lastComponent(ni.Network))}View on GitHub (pinned to 4c8573c808)
Solutions
- Inspect the wrapped inner error to see the offending SourceImage URL
- Identify which instance template (matching the NamePrefix) has the malformed SourceImage
- Fix the template's SourceImage to a fully-qualified project-global image URL (e.g. via gcloud compute instance-templates or recreating it with kOps)
- If the template was created out-of-band and is unwanted, delete it so Find no longer matches it
- Upgrade kOps — newer versions may parse more URL forms
Example fix
// before (out-of-band template) gcloud compute instance-templates create mytpl --image-family ubuntu-2004-lts --image-project ubuntu-os-cloud // after # use a fully-qualified source image, or let kOps create/replace the template: gcloud compute instances ... --image https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20240307b # or delete the stray template: gcloud compute instance-templates delete mytpl
Defensive patterns
Strategy: validation
Validate before calling
# Ensure any instance template matching your kOps NamePrefix uses a fully-qualified image URL:
gcloud compute instance-templates list --format="value(name)" | grep '^<nameprefix>-' | \
xargs -I{} sh -c 'gcloud compute instance-templates describe {} --format="value(properties.disks[0].initializeParams.sourceImage)" | grep -q "compute/v1/projects/.*/global/images/" || echo "BAD image URL on {}"' Prevention
- Always create templates with fully-qualified source image URLs, not families or short names
- Let kOps manage all instance templates whose names share your NamePrefix
- Clean up out-of-band templates (or name them differently) so Find never matches them
- Pin BootDiskImage in the kOps spec to 'project/image' form kOps expects
When it happens
Trigger: An instance template whose boot disk SourceImage doesn't match the expected https://www.googleapis.com/compute/v1/projects/<proj>/global/images/<name> format — e.g. the template was created out-of-band using an image family URL, a deprecated/custom image reference, or an empty/odd SourceImage value.
Common situations: Manual template creation via gcloud with `--image-family` or a shortened image name; images created in a different project; templates built by other tooling that kOps' Find loop then encounters while prefix-matching.
Related errors
- instance %s did not have Version set
- ig name not set on instance template %s
- cannot parse network name %q as either project/network or ne
- error deleting InstanceTemplate %s: %w
- expected protocol[:portspec] in firewall rule %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/cf1bdf750376d636.
Report an issue: GitHub.