{"record":{"id":"181e92d39f2de05e","repo":"kubernetes/kops","slug":"failed-to-get-networks-matching-label-selector-q","errorCode":null,"errorMessage":"failed to get networks matching label selector %q: %w","messagePattern":"failed to get networks matching label selector %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/hetzner/cloud.go","lineNumber":165,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to get SSH keys matching label selector %q: %w\", labelSelector, err)\n\t}\n\n\treturn matches, nil\n}\n\nfunc (c *hetznerCloudImplementation) GetNetworks(clusterName string) ([]*hcloud.Network, error) {\n\tclient := c.NetworkClient()\n\n\tlabelSelector := TagKubernetesClusterName + \"=\" + clusterName\n\tlistOptions := hcloud.ListOpts{\n\t\tPerPage:       50,\n\t\tLabelSelector: labelSelector,\n\t}\n\tnetworkListOptions := hcloud.NetworkListOpts{ListOpts: listOptions}\n\n\tmatches, err := client.AllWithOpts(context.TODO(), networkListOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get networks matching label selector %q: %w\", labelSelector, err)\n\t}\n\n\treturn matches, nil\n}\n\nfunc (c *hetznerCloudImplementation) GetFirewalls(clusterName string) ([]*hcloud.Firewall, error) {\n\tclient := c.FirewallClient()\n\n\tlabelSelector := TagKubernetesClusterName + \"=\" + clusterName\n\tlistOptions := hcloud.ListOpts{\n\t\tPerPage:       50,\n\t\tLabelSelector: labelSelector,\n\t}\n\tfirewallListOptions := hcloud.FirewallListOpts{ListOpts: listOptions}\n\n\tmatches, err := client.AllWithOpts(context.TODO(), firewallListOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get firewalls matching label selector %q: %w\", labelSelector, err)","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/hetzner/cloud.go#L147-L183","documentation":"hetznerCloudImplementation.GetNetworks lists Hetzner Cloud networks filtered by label selector via AllWithOpts. Any listing error is wrapped with the selector. It indicates the Hetzner Networks API call failed, not that no networks match.","triggerScenarios":"client.AllWithOpts(context.TODO(), networkListOptions) errors: bad API token, network/API outage, rate limiting, malformed label selector, or network connectivity failure.","commonSituations":"Token lacking read scope for networks; Hetzner API incident (check status.hetzner.com); invalid selector label key/value typo in the cluster config; rate limits when many resources are reconciled at once.","solutions":["Verify token validity/scopes: `hcloud network list` with the same credentials","Check Hetzner Cloud status page for API incidents","Validate the label selector string used in the cluster spec","Retry after backoff if rate-limited"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"curl -s -H \"Authorization: Bearer $HCLOUD_TOKEN\" 'https://api.hetzner.cloud/v1/networks?label_selector=kubernetes.io%2Fcluster%3D<name>' | head -c 200","typeGuard":null,"tryCatchPattern":"nets, err := GetNetworks(ctx, selector)\nif err != nil { return fmt.Errorf(\"hetzner network lookup failed (check token/scopes): %w\", err) }","preventionTips":["Use a token with read access to networks for the correct project","Verify label selector key/value syntax before applying","Watch Hetzner status page and retry on 5xx/429"],"tags":["hetzner","network","cloud-api"],"backgroundTag":"cloud-api-auth-failure","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"}