{"record":{"id":"a96f836b238406e1","repo":"kubernetes/kops","slug":"unable-to-find-region-a96f83","errorCode":null,"errorMessage":"unable to find region","messagePattern":"unable to find region","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/verifier.go","lineNumber":61,"sourceCode":"type OpenStackVerifierOptions struct {\n}\n\ntype openstackVerifier struct {\n\tnovaClient *gophercloud.ServiceClient\n\tkubeClient *kubernetes.Clientset\n}\n\nvar _ bootstrap.Verifier = (*openstackVerifier)(nil)\n\nfunc NewOpenstackVerifier(opt *OpenStackVerifierOptions) (bootstrap.Verifier, error) {\n\tenv, err := gos.AuthOptionsFromEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tregion := os.Getenv(\"OS_REGION_NAME\")\n\tif region == \"\" {\n\t\treturn nil, fmt.Errorf(\"unable to find region\")\n\t}\n\n\tprovider, err := gos.NewClient(env.IdentityEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tua := gophercloud.UserAgent{}\n\tua.Prepend(\"kops/kopscontrollerverifier\")\n\tprovider.UserAgent = ua\n\tklog.V(4).Infof(\"Using user-agent %s\", ua.Join())\n\n\t// node-controller should be able to renew it tokens against OpenStack API\n\tenv.AllowReauth = true\n\n\terr = gos.Authenticate(context.TODO(), provider, env)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/verifier.go#L43-L79","documentation":"Thrown by NewOpenstackVerifier when the OS_REGION_NAME environment variable is unset or empty. The verifier needs the region to build region-scoped Nova (compute V2) endpoints; without it, client construction cannot proceed, so it fails fast before contacting OpenStack.","triggerScenarios":"Running the kops verifier binary (via main) after openstack credential env loading, where OS_REGION_NAME is missing — not set in the shell, absent from the sourced RC file, or not injected in CI.","commonSituations":"Forgetting to source the OpenStack RC (openrc) file that sets OS_REGION_NAME; clouds.yaml-based auth that doesn't export a region; CI environments with partial OS_* credential injection; region renamed by the cloud operator.","solutions":["Export the region before running: `export OS_REGION_NAME=<region>` (find it via `openstack region list`).","Re-source the correct OpenStack RC file that includes OS_REGION_NAME.","If using CI/scripts, add OS_REGION_NAME alongside the other OS_* variables."],"exampleFix":"// before\n./kops-verifier ...  # fails: unable to find region\n// after\nexport OS_REGION_NAME=$(openstack region list -f value -c Region | head -1)\n./kops-verifier ...","handlingStrategy":"validation","validationCode":"region := os.Getenv(\"OS_REGION_NAME\")\nif region == \"\" {\n    return errors.New(\"OS_REGION_NAME must be set; source your openrc file\")\n}","typeGuard":null,"tryCatchPattern":"verifier, err := NewOpenstackVerifier(ctx, buildEnv, cluster, kubeClientConfig)\nif err != nil {\n    log.Fatalf(\"verifier init: %v (did you source openrc?)\", err)\n}","preventionTips":["Always source the openrc file before running the verifier","Add a startup check for required OS_* env vars","In CI, include OS_REGION_NAME in the secrets/env injection"],"tags":["openstack","environment","configuration","region"],"backgroundTag":"missing-env-var","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"}