juicedata/juicefs · error

failed to load config: %s

Error message

failed to load config: %s

What it means

Returned by newWasabi when the AWS SDK's LoadDefaultConfig fails while constructing the Wasabi client config — invalid credentials or a broken AWS config/environment. The wrapped error identifies the failing config source.

Source

Thrown at pkg/object/wasabi.go:67

func newWasabi(endpoint, accessKey, secretKey, token string) (ObjectStorage, error) {
	if !strings.Contains(endpoint, "://") {
		endpoint = fmt.Sprintf("https://%s", endpoint)
	}
	uri, err := url.ParseRequestURI(endpoint)
	if err != nil {
		return nil, fmt.Errorf("Invalid endpoint %s: %s", endpoint, err)
	}
	ssl := strings.ToLower(uri.Scheme) == "https"
	hostParts := strings.Split(uri.Host, ".")
	bucket := hostParts[0]
	region := hostParts[2]
	endpoint = uri.Scheme + "://" + uri.Host[len(bucket)+1:]

	awsCfg, err := config.LoadDefaultConfig(ctx, append(defaultChecksumOpts(),
		config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, token)))...)
	if err != nil {
		return nil, fmt.Errorf("failed to load config: %s", err)
	}
	client := s3.NewFromConfig(awsCfg, func(options *s3.Options) {
		options.Region = region
		options.BaseEndpoint = aws.String(endpoint)
		options.EndpointOptions.DisableHTTPS = !ssl
		options.UsePathStyle = false
		options.HTTPClient = httpClient
		options.APIOptions = append(options.APIOptions, func(stack *smithymiddleware.Stack) error {
			return v4.SwapComputePayloadSHA256ForUnsignedPayloadMiddleware(stack)
		}, addS3UserAgent)
		options.RetryMaxAttempts = 1
	})
	return &wasabi{s3client{bucket: bucket, s3: client, region: region}}, nil
}

func init() {
	Register("wasabi", newWasabi)
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Check the wrapped message; ensure access key and secret are non-empty and correct
  2. Validate ~/.aws/credentials and ~/.aws/config syntax if they exist
  3. Regenerate the Wasabi access key pair if it is malformed/revoked
  4. Pass credentials explicitly in the URL rather than relying on shared config

Example fix

// before
wasabi://bucket?endpoint=s3.wasabisys.com&accessKey=&secretKey=
// after
wasabi://bucket?endpoint=s3.wasabisys.com&accessKey=AKIA...&secretKey=...
Defensive patterns

Strategy: validation

Validate before calling

func haveCreds(ak, sk string) error { if strings.TrimSpace(ak) == "" || strings.TrimSpace(sk) == "" { return errors.New("empty credentials") }; return nil }

Try / catch

_, err := object.CreateStorage(ctx, "wasabi", url, ak, sk)
if err != nil && strings.HasPrefix(err.Error(), "failed to load config") {
	// validate credentials and ~/.aws files before retry
}

Prevention

When it happens

Trigger: config.LoadDefaultConfig fails, typically because the static credentials provider rejects input (empty access key/secret key) or a shared config/profile file is malformed (bad ~/.aws/config, invalid profile).

Common situations: Empty or whitespace-only access key/secret passed to the wasabi URL; corrupted ~/.aws/credentials or ~/.aws/config; AWS_SDK_LOAD_CONFIG issues with invalid profile syntax; unsupported characters in token.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/c2170e2c8c0e8950. Report an issue: GitHub.