{"record":{"id":"c13ed18dd16466e5","repo":"juicedata/juicefs","slug":"failed-to-load-config-s-c13ed1","errorCode":null,"errorMessage":"failed to load config: %s","messagePattern":"failed to load config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/minio.go","lineNumber":91,"sourceCode":"\t}\n\tif region == \"\" {\n\t\tregion = awsDefaultRegion\n\t}\n\tif accessKey == \"\" {\n\t\taccessKey = os.Getenv(\"MINIO_ACCESS_KEY\")\n\t}\n\tif secretKey == \"\" {\n\t\tsecretKey = os.Getenv(\"MINIO_SECRET_KEY\")\n\t}\n\tvar cfg aws.Config\n\tif accessKey != \"\" {\n\t\tcfg, err = config.LoadDefaultConfig(ctx, append(defaultChecksumOpts(),\n\t\t\tconfig.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, token)))...)\n\t} else {\n\t\tcfg, err = config.LoadDefaultConfig(ctx, defaultChecksumOpts()...)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load config: %s\", err)\n\t}\n\tclient := s3.NewFromConfig(cfg, func(options *s3.Options) {\n\t\toptions.Region = region\n\t\toptions.BaseEndpoint = aws.String(uri.Scheme + \"://\" + uri.Host)\n\t\toptions.EndpointOptions.DisableHTTPS = !ssl\n\t\toptions.UsePathStyle = defaultPathStyle()\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\tif len(uri.Path) < 2 {\n\t\treturn nil, fmt.Errorf(\"no bucket name provided in %s\", endpoint)\n\t}\n\tbucket := uri.Path[1:]\n\tif strings.Contains(bucket, \"/\") && strings.HasPrefix(bucket, \"minio/\") {\n\t\tbucket = bucket[len(\"minio/\"):]","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/minio.go#L73-L109","documentation":"newMinio builds an AWS SDK v2 config via config.LoadDefaultConfig, supplying static credentials when accessKey is set. If config loading itself fails (malformed shared config/credentials files, invalid profile, invalid SDK env values), the constructor returns this wrapped error.","triggerScenarios":"AWS SDK config initialization failing due to malformed ~/.aws/config or ~/.aws/credentials, a broken profile referenced by AWS_PROFILE, or invalid values for SDK environment variables.","commonSituations":"Corrupted or hand-edited AWS shared config files on the machine running JuiceFS; AWS_CONFIG_FILE pointing to a missing/invalid file; files written by older tooling that the current SDK rejects.","solutions":["Read the wrapped error's underlying cause and fix the offending config/credentials file or env variable.","Set AWS_PROFILE/AWS_CONFIG_FILE explicitly, or unset them to use defaults.","Verify ~/.aws/config and ~/.aws/credentials parse correctly (e.g. with 'aws configure list')."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if os.Getenv(\"AWS_CONFIG_FILE\") != \"\" {\n\tif _, err := os.Stat(os.Getenv(\"AWS_CONFIG_FILE\")); err != nil {\n\t\treturn fmt.Errorf(\"AWS_CONFIG_FILE missing: %w\", err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"store, err := newMinio(endpoint, ak, sk, \"\")\nif err != nil && strings.Contains(err.Error(), \"failed to load config\") {\n\t// inspect ~/.aws files and SDK env vars, then retry\n\treturn err\n}","preventionTips":["Pass static credentials explicitly so the SDK skips shared-file loading.","Keep ~/.aws/config and ~/.aws/credentials syntactically valid (INI).","Avoid pointing AWS_CONFIG_FILE/AWS_PROFILE at nonexistent resources."],"tags":["object-storage","aws-sdk","configuration"],"backgroundTag":"invalid-config-value","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"}