{"record":{"id":"c2170e2c8c0e8950","repo":"juicedata/juicefs","slug":"failed-to-load-config-s-c2170e","errorCode":null,"errorMessage":"failed to load config: %s","messagePattern":"failed to load config: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/wasabi.go","lineNumber":67,"sourceCode":"\nfunc newWasabi(endpoint, accessKey, secretKey, token string) (ObjectStorage, error) {\n\tif !strings.Contains(endpoint, \"://\") {\n\t\tendpoint = fmt.Sprintf(\"https://%s\", endpoint)\n\t}\n\turi, err := url.ParseRequestURI(endpoint)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid endpoint %s: %s\", endpoint, err)\n\t}\n\tssl := strings.ToLower(uri.Scheme) == \"https\"\n\thostParts := strings.Split(uri.Host, \".\")\n\tbucket := hostParts[0]\n\tregion := hostParts[2]\n\tendpoint = uri.Scheme + \"://\" + uri.Host[len(bucket)+1:]\n\n\tawsCfg, err := config.LoadDefaultConfig(ctx, append(defaultChecksumOpts(),\n\t\tconfig.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, token)))...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load config: %s\", err)\n\t}\n\tclient := s3.NewFromConfig(awsCfg, func(options *s3.Options) {\n\t\toptions.Region = region\n\t\toptions.BaseEndpoint = aws.String(endpoint)\n\t\toptions.EndpointOptions.DisableHTTPS = !ssl\n\t\toptions.UsePathStyle = false\n\t\toptions.HTTPClient = httpClient\n\t\toptions.APIOptions = append(options.APIOptions, func(stack *smithymiddleware.Stack) error {\n\t\t\treturn v4.SwapComputePayloadSHA256ForUnsignedPayloadMiddleware(stack)\n\t\t}, addS3UserAgent)\n\t\toptions.RetryMaxAttempts = 1\n\t})\n\treturn &wasabi{s3client{bucket: bucket, s3: client, region: region}}, nil\n}\n\nfunc init() {\n\tRegister(\"wasabi\", newWasabi)\n}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/wasabi.go#L49-L85","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the wrapped message; ensure access key and secret are non-empty and correct","Validate ~/.aws/credentials and ~/.aws/config syntax if they exist","Regenerate the Wasabi access key pair if it is malformed/revoked","Pass credentials explicitly in the URL rather than relying on shared config"],"exampleFix":"// before\nwasabi://bucket?endpoint=s3.wasabisys.com&accessKey=&secretKey=\n// after\nwasabi://bucket?endpoint=s3.wasabisys.com&accessKey=AKIA...&secretKey=...","handlingStrategy":"validation","validationCode":"func haveCreds(ak, sk string) error { if strings.TrimSpace(ak) == \"\" || strings.TrimSpace(sk) == \"\" { return errors.New(\"empty credentials\") }; return nil }","typeGuard":null,"tryCatchPattern":"_, err := object.CreateStorage(ctx, \"wasabi\", url, ak, sk)\nif err != nil && strings.HasPrefix(err.Error(), \"failed to load config\") {\n\t// validate credentials and ~/.aws files before retry\n}","preventionTips":["Never pass empty access/secret keys","Check ~/.aws/config and ~/.aws/credentials parse correctly","Regenerate Wasabi keys that may be malformed or revoked"],"tags":["wasabi","aws-sdk","credentials","config"],"backgroundTag":"missing-credentials","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}