kubernetes/kops · error

loading Scaleway config file: %w

Error message

loading Scaleway config file: %w

What it means

In getScalewayProfile, scw.LoadConfig failed while trying to honor a non-empty SCW_PROFILE environment variable. The Scaleway SDK could not read/parse ~/.config/scw/config.yaml — the file is missing, unreadable, or malformed YAML. This only fires when SCW_PROFILE is set; otherwise the function returns nil early.

Source

Thrown at upup/pkg/fi/cloudup/scaleway/scalewaymetadata/profile.go:35

package scalewaymetadata

import (
	"fmt"
	"os"

	"github.com/scaleway/scaleway-sdk-go/scw"
	k8serrors "k8s.io/apimachinery/pkg/util/errors"
	"k8s.io/kops/upup/pkg/fi"
)

func getScalewayProfile() (*scw.Profile, error) {
	scwProfileName := os.Getenv("SCW_PROFILE")
	if scwProfileName == "" {
		return nil, nil
	}
	config, err := scw.LoadConfig()
	if err != nil {
		return nil, fmt.Errorf("loading Scaleway config file: %w", err)
	}
	profile, ok := config.Profiles[scwProfileName]
	if !ok {
		return nil, fmt.Errorf("could not find Scaleway profile %q", scwProfileName)
	}
	return profile, nil
}

func checkCredentials(accessKey, secretKey, projectID string) []error {
	errList := []error(nil)
	if accessKey == "" {
		errList = append(errList, fmt.Errorf("SCW_ACCESS_KEY has to be set"))
	}
	if secretKey == "" {
		errList = append(errList, fmt.Errorf("SCW_SECRET_KEY has to be set"))
	}
	if projectID == "" {
		errList = append(errList, fmt.Errorf("SCW_DEFAULT_PROJECT_ID has to be set"))

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run 'scw init' or otherwise create a valid Scaleway config file
  2. Check the file's YAML syntax and permissions
  3. Unset SCW_PROFILE if you intend to rely on environment variables only
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/scaleway/scalewaymetadata/profile.go:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/dc3cc0befad64a62. Report an issue: GitHub.