Skip to content

A duplicated profile leads to useless "Unable to parse config file" #9261

Closed as not planned
@ymartin59

Description

@ymartin59

Describe the bug

In case you create a duplication of an existing profile, aws-cli just reports "Unable to parse config file .aws/config" without any clue of the offending profile.

It would make sense to report the line number and the source reason of parse failure which may be difficult to guess when working with few hundreds of lines in configuration.

Thank you in advance

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

It would make sense to report the line number and the source reason of parsing failure: duplicated profile "xxx" at line yyy

Current Behavior

Reports only: Unable to parse config file: C:\Users\zzzzzz/.aws/config

Reproduction Steps

Duplicate a profile with same name in .aws/config for instance

[profile test]
region = eu-central-1
output = json

[profile test]
region = eu-central-1
output = json

Possible Solution

A fix suggestion: reports line number and the source reason of parse failure:

Unable to parse config file: C:\Users\zzzzzz/.aws/config`. Duplicated declaration of profile 'test' at line 5.

Additional Information/Context

No response

CLI version used

aws-cli/2.23.3 Python/3.12.6 Windows/11 exe/AMD64

Environment details (OS name and version, etc.)

Windows 11

Metadata

Metadata

Labels

feature-requestA feature should be added or improved.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions