{"record":{"id":"5d1b9806a07ae630","repo":"kubernetes/kops","slug":"converting-zone-s-to-region-w","errorCode":null,"errorMessage":"converting zone %s to region: %w","messagePattern":"converting zone (.+?) to region: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scaleway/cloud.go","lineNumber":502,"sourceCode":"\t}\n\treturn clusterSSHKeys, nil\n}\n\nfunc (s *scwCloudImplementation) GetClusterVolumes(clusterName string) ([]*instance.Volume, error) {\n\tvolumes, err := s.instanceAPI.ListVolumes(&instance.ListVolumesRequest{\n\t\tZone: s.zone,\n\t\tTags: []string{TagClusterName + \"=\" + clusterName},\n\t}, scw.WithAllPages())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list cluster volumes: %w\", err)\n\t}\n\treturn volumes.Volumes, nil\n}\n\nfunc (s *scwCloudImplementation) GetServerIP(serverID string, zone scw.Zone) (string, error) {\n\tregion, err := zone.Region()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"converting zone %s to region: %w\", zone, err)\n\t}\n\n\tips, err := s.ipamAPI.ListIPs(&ipam.ListIPsRequest{\n\t\tRegion:     region,\n\t\tIsIPv6:     new(false),\n\t\tResourceID: &serverID,\n\t\tZonal:      new(zone.String()),\n\t}, scw.WithAllPages())\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"listing IPs for server %s: %w\", serverID, err)\n\t}\n\n\tif len(ips.IPs) < 1 {\n\t\treturn \"\", fmt.Errorf(\"could not find IP for server %s\", serverID)\n\t}\n\tif len(ips.IPs) > 1 {\n\t\tklog.V(10).Infof(\"Found more than 1 IP for server %s, using %s\", serverID, ips.IPs[0].Address.IP.String())\n\t}","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scaleway/cloud.go#L484-L520","documentation":"Returned by GetServerIP when scw.Zone.Region() fails to derive a region from the zone string. Scaleway zones like `fr-par-1` map to region `fr-par`; an unparseable or malformed zone value causes this error. The zone and the underlying error are wrapped with %w.","triggerScenarios":"zone value is empty, malformed (e.g. missing the numeric suffix like `fr-par-`), a region name passed by mistake instead of a zone (e.g. `fr-par`), or a zone string from an unknown/new region the SDK version doesn't recognize.","commonSituations":"Cluster config or cloud group built with a region instead of a zone; server discovered in a zone newer than the vendored Scaleway SDK version; empty zone propagated from an earlier failed lookup.","solutions":["Print/verify the zone value reaching GetServerIP; it must be a full zone like `fr-par-1`, not a region.","Upgrade kops / the scaleway-go SDK to a version that knows the zone's region (new zones require newer SDKs).","Fix the cloud group or cluster spec that supplied the malformed zone.","Guard the call site: validate the zone format before calling GetServerIP."],"exampleFix":"// before\nzone := group.Zone // possibly \"fr-par\" (a region)\nip, err := cloud.GetServerIP(serverID, zone)\n// after\nzone := group.Zone\nif strings.Count(string(zone), \"-\") < 2 {\n  return fmt.Errorf(\"invalid zone %q, expected format like fr-par-1\", zone)\n}\nip, err := cloud.GetServerIP(serverID, zone)","handlingStrategy":"validation","validationCode":"func isZone(s string) bool {\n  return regexp.MustCompile(`^[a-z]{2}-[a-z]+-[0-9]+$`).MatchString(s)\n}\n// call only if isZone(string(zone))","typeGuard":"func validZone(z scw.Zone) bool {\n  _, err := z.Region()\n  return err == nil\n}","tryCatchPattern":null,"preventionTips":["Store zones (not regions) in cluster/group config and assert the `xx-yyy-N` shape at config load.","Upgrade kops/SDK when adopting newly launched Scaleway zones.","Reject empty or defaulted zone strings early in cloud-group construction."],"tags":["scaleway","zone","configuration","validation"],"backgroundTag":"invalid-cloud-zone-name","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}