{"record":{"id":"e2fbb6ac0c48b25f","repo":"kubernetes/kops","slug":"region-is-required","errorCode":null,"errorMessage":"region is required","messagePattern":"region is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/linode/cloud.go","lineNumber":85,"sourceCode":"\n// LinodeCloud exposes Akamai (Linode) cloud APIs used by kOps.\ntype LinodeCloud interface {\n\tfi.Cloud\n\tClient() LinodeClient\n}\n\ntype Cloud struct {\n\tregion string\n\tclient LinodeClient\n}\n\nvar _ LinodeCloud = &Cloud{}\n\nvar invalidLinodeLabelChars = regexp.MustCompile(`[^A-Za-z0-9_-]+`)\n\nfunc NewCloud(region string) (LinodeCloud, error) {\n\tif region == \"\" {\n\t\treturn nil, fmt.Errorf(\"region is required\")\n\t}\n\n\taccessToken := os.Getenv(\"LINODE_TOKEN\")\n\tif accessToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"%s is required\", \"LINODE_TOKEN\")\n\t}\n\n\tclient, err := linodego.NewClient(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create Linode client: %w\", err)\n\t}\n\tclient.SetUserAgent(\"kops/\" + kopsv.Version)\n\tclient.SetToken(accessToken)\n\n\treturn &Cloud{\n\t\tregion: region,\n\t\tclient: &client,\n\t}, nil","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/linode/cloud.go#L67-L103","documentation":"NewCloud for the Akamai (Linode) provider requires a cloud region string to construct the Cloud object. An empty region means the cloud abstraction cannot be scoped, so construction is rejected immediately with 'region is required'.","triggerScenarios":"BuildCloud calls NewCloud(\"\") — i.e. the cluster spec has no region set for the Linode provider, or the region was not propagated from the cluster configuration.","commonSituations":"Creating/updating a Linode-backed cluster whose cluster.yaml lacks the `region` field, or programmatic callers building the cloud before the cluster spec is fully populated.","solutions":["Set `spec.region` (top-level kops cluster region) to a valid Linode region, e.g. us-east or eu-west, in the cluster manifest.","Re-run `kops create/replace -f cluster.yaml && kops update cluster`.","If calling NewCloud programmatically, pass the region explicitly instead of relying on defaults."],"exampleFix":"// before (cluster.yaml)\nmetadata:\n  name: cluster.example.com\n// after\nmetadata:\n  name: cluster.example.com\nspec:\n  region: us-east","handlingStrategy":"validation","validationCode":"if cluster.Spec.Region == \"\" {\n\treturn fmt.Errorf(\"cluster.spec.region must be set for the Linode provider (e.g. us-east)\")\n}","typeGuard":"func hasRegion(c *kops.Cluster) bool { return c != nil && c.Spec.Region != \"\" }","tryCatchPattern":"cloud, err := BuildCloud(...)\nif err != nil {\n\tif strings.Contains(err.Error(), \"region is required\") {\n\t\t// prompt user / fail fast with guidance to set spec.region\n\t}\n}","preventionTips":["Set spec.region in every Linode cluster manifest before create/update","Add a pre-flight lint step validating region presence for the chosen cloud provider","Use a valid Linode region name (us-east, eu-west, ap-south, etc.)"],"tags":["linode","akamai","region","config-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}