{"record":{"id":"f62bcd22af0e0ab0","repo":"plandex-ai/plandex","slug":"failed-to-load-aws-config-v","errorCode":null,"errorMessage":"failed to load AWS config: %v","messagePattern":"failed to load AWS config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/model_credentials.go","lineNumber":330,"sourceCode":"\t\t\treturn s, nil\n\t\t}\n\t}\n\n\tcontent, err := os.ReadFile(pathOrJson)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(content), nil\n}\n\nfunc loadAWSVars(vars map[string]string) error {\n\t// disable IMDS to prevent slow request\n\tos.Setenv(\"AWS_EC2_METADATA_DISABLED\", \"true\")\n\n\tcfg, err := config.LoadDefaultConfig(context.Background())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load AWS config: %v\", err)\n\t}\n\n\tcreds, err := cfg.Credentials.Retrieve(context.Background())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve AWS credentials: %v\", err)\n\t}\n\n\tvars[\"AWS_ACCESS_KEY_ID\"] = creds.AccessKeyID\n\tvars[\"AWS_SECRET_ACCESS_KEY\"] = creds.SecretAccessKey\n\tvars[\"AWS_REGION\"] = cfg.Region\n\tif creds.SessionToken != \"\" {\n\t\tvars[\"AWS_SESSION_TOKEN\"] = creds.SessionToken\n\t}\n\n\treturn nil\n}\n\nfunc mergeAuthVars(dest, src map[string]string) {","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/model_credentials.go#L312-L348","documentation":"loadAWSVars uses the AWS SDK's config.LoadDefaultConfig to build AWS credentials for Bedrock-style auth. This error means the SDK could not construct a config/credential chain at all (bad region string, malformed profile, or unrecoverable config error). Note callers deliberately swallow this error when PLANDEX_AWS_PROFILE is unset or fails, so it usually only surfaces via the fallback logging path.","triggerScenarios":"loadAWSVars runs (only when PLANDEX_AWS_PROFILE is set) and config.LoadDefaultConfig returns an error: invalid AWS_PROFILE name, malformed ~/.aws/config or ~/.aws/credentials, or an invalid AWS_REGION value that the SDK cannot parse.","commonSituations":"PLANDEX_AWS_PROFILE names a profile absent from ~/.aws/credentials, a hand-edited AWS config with broken INI syntax, an invalid region string, or a shared-credentials file with wrong permissions/format.","solutions":["Check the profile named by PLANDEX_AWS_PROFILE/AWS_PROFILE exists in ~/.aws/credentials and ~/.aws/config.","Validate ~/.aws/config and ~/.aws/credentials INI syntax (no duplicated or malformed keys).","Set a valid AWS_REGION (e.g. us-east-1) in the environment or the profile.","Test independently with `aws sts get-caller-identity --profile <profile>` to reproduce outside the CLI."],"exampleFix":"// before\nexport PLANDEX_AWS_PROFILE=\"prod\"\n// after\nexport PLANDEX_AWS_PROFILE=\"prod\"\nexport AWS_REGION=\"us-east-1\"\ngrep -q \"^\\[prod\\]\" ~/.aws/credentials || echo \"profile 'prod' missing from ~/.aws/credentials\"","handlingStrategy":"validation","validationCode":"func awsProfileReady() error {\n    profile := os.Getenv(\"PLANDEX_AWS_PROFILE\")\n    if profile == \"\" { return nil }\n    data, err := os.ReadFile(filepath.Join(os.Getenv(\"HOME\"), \".aws\", \"credentials\"))\n    if err != nil { return err }\n    if !strings.Contains(string(data), \"[\"+profile+\"]\") {\n        return fmt.Errorf(\"profile %q not found in ~/.aws/credentials\", profile)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := loadAWSVars(vars); err != nil {\n    log.Printf(\"AWS vars unavailable, continuing with env-var auth: %v\", err)\n    // the library already falls through to default env-var checks\n}","preventionTips":["Confirm PLANDEX_AWS_PROFILE exists in ~/.aws/credentials before enabling","Set AWS_REGION explicitly","Test with `aws sts get-caller-identity --profile <profile>`","Validate shared-credentials INI syntax after hand edits"],"tags":["aws","credentials","config"],"backgroundTag":"aws-config-load-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}