{"record":{"id":"a26cfea65a1d401c","repo":"kubernetes/kops","slug":"error-building-swift-client-v","errorCode":null,"errorMessage":"error building swift client: %v","messagePattern":"error building swift client: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/swiftfs.go","lineNumber":95,"sourceCode":"\t}\n\n\tvar endpointOpt gophercloud.EndpointOpts\n\tif region, err := config.GetRegion(); err != nil {\n\t\tklog.Warningf(\"Retrieving swift configuration from openstack config file: %v\", err)\n\t\tendpointOpt, err = config.GetServiceConfig(\"Swift\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tendpointOpt = gophercloud.EndpointOpts{\n\t\t\tType:   \"object-store\",\n\t\t\tRegion: region,\n\t\t}\n\t}\n\n\tclient, err := openstack.NewObjectStorageV1(pc, endpointOpt)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building swift client: %v\", err)\n\t}\n\treturn client, nil\n}\n\ntype OpenstackConfig struct{}\n\nfunc (OpenstackConfig) filename() (string, error) {\n\tname := os.Getenv(\"OPENSTACK_CREDENTIAL_FILE\")\n\tif name != \"\" {\n\t\tklog.V(2).Infof(\"using openstack config found in $OPENSTACK_CREDENTIAL_FILE: %s\", name)\n\t\treturn name, nil\n\t}\n\n\thomeDir := homedir.HomeDir()\n\tif homeDir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"can not find home directory\")\n\t}\n\tf := filepath.Join(homeDir, \".openstack\", \"config\")","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/swiftfs.go#L77-L113","documentation":"NewSwiftClient finally creates the Object Storage v1 service client via openstack.NewObjectStorageV1(pc, endpointOpt). This fails when the endpoint options are incomplete (missing region) or the Swift service cannot be resolved from the catalog, producing this wrapped error.","triggerScenarios":"getSwiftClient -> NewSwiftClient when the region could not be determined (GetRegion warned and GetServiceConfig('Swift') also failed, yielding a zero endpointOpt) or the Keystone catalog lacks a Swift/object-store entry for the region.","commonSituations":"OS_REGION_NAME unset and no [Global] region in the openstack config, a deployment without object-store service in the catalog, or misnamed service in the catalog for the requested region.","solutions":["Set OS_REGION_NAME to the region hosting your Swift service.","Add 'region = <region>' to the [Global] section of ~/.openstack/config.","Verify the object-store service exists: openstack service list | grep object-store and openstack endpoint list.","Check GetServiceConfig('Swift') section in the config file provides a valid region/URL."],"exampleFix":"// before (~/.openstack/config)\n[Global]\n; region missing\n// after\n[Global]\nregion = RegionOne","handlingStrategy":"validation","validationCode":"// Ensure a region is available before building the swift client\nif os.Getenv(\"OS_REGION_NAME\") == \"\" {\n\treturn errors.New(\"set OS_REGION_NAME or region in [Global] config section\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Export OS_REGION_NAME in every environment that runs kops","Confirm the object-store service exists: openstack service list","Keep [Global] region in sync with the keystone catalog region","For multi-region clouds, pin the region in OPENSTACK_CREDENTIAL_FILE"],"tags":["openstack","swift","region","endpoint"],"backgroundTag":"swift-endpoint-not-found","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"}