{"record":{"id":"02e4c196eb84e17d","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-read-shared-credentials-for-profile-q-w","errorCode":null,"errorMessage":"cannot read shared credentials for profile %q: %w","messagePattern":"cannot read shared credentials for profile %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/awsapi/config.go","lineNumber":260,"sourceCode":"\t\tacNew = ac\n\tcase len(cfg.profile) > 0:\n\t\tsourceProfile, profileRoleARN, err := readAWSConfigFile(cfg.profile)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot read config file for profile %q: %w\", cfg.profile, err)\n\t\t}\n\t\tcredProfile := cfg.profile\n\t\tif sourceProfile != \"\" {\n\t\t\tif sourceProfile == cfg.profile {\n\t\t\t\treturn nil, fmt.Errorf(\"source_profile for %q points to itself\", cfg.profile)\n\t\t\t}\n\t\t\tcredProfile = sourceProfile\n\t\t}\n\t\tif roleARN == \"\" {\n\t\t\troleARN = profileRoleARN\n\t\t}\n\t\tac, err := readSharedCredentials(credProfile)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot read shared credentials for profile %q: %w\", credProfile, err)\n\t\t}\n\t\tif ac == nil {\n\t\t\treturn nil, fmt.Errorf(\"missing credentials for profile %q\", credProfile)\n\t\t}\n\t\tacNew = ac\n\tdefault:\n\t\t// we need instance credentials if we do not have access keys\n\t\tac, err := getInstanceRoleCredentials(cfg.client)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot obtain instance role credentials: %w\", err)\n\t\t}\n\t\tacNew = ac\n\t}\n\t// read credentials from sts api, if role_arn is defined\n\tif len(roleARN) > 0 {\n\t\tac, err := cfg.getRoleARNCredentials(acNew, roleARN)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot get credentials for role_arn %q: %w\", roleARN, err)","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/awsapi/config.go#L242-L278","documentation":"Fires in getAPICredentials when readSharedCredentials fails for credProfile (either cfg.profile or its resolved source_profile). The wrapped error typically indicates ~/.aws/credentials is missing, unreadable, or has no section for the profile.","triggerScenarios":"Thrown at lib/awsapi/config.go:260 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a [<profile>] section with aws_access_key_id and aws_secret_access_key to the shared credentials file","Verify AWS_SHARED_CREDENTIALS_FILE points to the correct file","Check file permissions allow reading by the process user"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}