{"record":{"id":"cebf2a3fa6897b13","repo":"kubernetes/kops","slug":"error-loading-aws-config-v-cebf2a","errorCode":null,"errorMessage":"error loading AWS config: %v","messagePattern":"error loading AWS config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/aws/identify.go","lineNumber":64,"sourceCode":"\tKarpenterNodeLabel = \"karpenter.sh/\"\n)\n\n// nodeIdentifier identifies a node from EC2\ntype nodeIdentifier struct {\n\t// client is the ec2 interface\n\tec2Client ec2.DescribeInstancesAPIClient\n\n\t// cache is a cache of nodeidentity.Info\n\tcache expirationcache.Store\n\t// cacheEnabled indicates if caching should be used\n\tcacheEnabled bool\n}\n\n// New creates and returns a nodeidentity.Identifier for Nodes running on AWS\nfunc New(ctx context.Context, cacheNodeidentityInfo bool) (nodeidentity.Identifier, error) {\n\tconfig, err := awsconfig.LoadDefaultConfig(ctx, awslog.WithAWSLogger())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error loading AWS config: %v\", err)\n\t}\n\n\timdsClient := imds.NewFromConfig(config)\n\n\tregionResp, err := imdsClient.GetRegion(ctx, &imds.GetRegionInput{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error querying ec2 metadata service (for region): %v\", err)\n\t}\n\n\tconfig.Region = regionResp.Region\n\tec2Client := ec2.NewFromConfig(config)\n\n\treturn &nodeIdentifier{\n\t\tec2Client:    ec2Client,\n\t\tcache:        expirationcache.NewTTLStore(stringKeyFunc, cacheTTL),\n\t\tcacheEnabled: cacheNodeidentityInfo,\n\t}, nil\n}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/aws/identify.go#L46-L82","documentation":"AWS SDK default config (credentials, region, shared config files) could not be loaded while constructing the AWS node-identity identifier on a node. This fails before any EC2 call is made; causes include bad credentials files or environment.","triggerScenarios":"Thrown at pkg/nodeidentity/aws/identify.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify AWS credentials (env vars, shared credentials file, or instance role) are present and valid","Check ~/.aws/config and environment for malformed settings","Ensure node instances have an IAM instance profile that permits IMDS/EC2 access"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}