Skip to content

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

Closed as not planned

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

Activity

  1. added
    bugThis issue is a bug.
    needs-triageThis issue or PR still needs to be triaged.
    on Jan 30, 2025
  2. added
    investigatingThis issue is being investigated and/or work is in progress to resolve the issue.
    p3This is a minor priority issue
    needs-reviewThis issue or pull request needs review from a core team member.
    feature-requestA feature should be added or improved.
    and removed
    needs-triageThis issue or PR still needs to be triaged.
    investigatingThis issue is being investigated and/or work is in progress to resolve the issue.
    bugThis issue is a bug.
    on Jan 30, 2025
  3. RyanFitzSimmonsAK commented on Jan 30, 2025

    @RyanFitzSimmonsAK
    Contributor

    Hi @ymartin59, thanks for reaching out. I was able to reproduce this behavior, but I don't think it really counts as a bug. However, I do see the value in having a more detailed error message here. I'll bring it up with the team for review.

  4. removed
    needs-reviewThis issue or pull request needs review from a core team member.
    on Feb 3, 2025
  5. RyanFitzSimmonsAK commented on Feb 3, 2025

    @RyanFitzSimmonsAK
    Contributor

    Hey, thanks for your patience. We're going to be closing this feature request at this time. Right now, as you pointed out, all malformed profile errors produce the same error, and changing that would require writing an entirely new parser. We'll be taking a backlog item to add more detailed information about handling config file parsing errors in the AWS CLI troubleshooting guide. Thanks again for opening this.

  6. github-actions commented on Feb 3, 2025

    @github-actions
    Contributor

    This issue is now closed. Comments on closed issues are hard for our team to see.
    If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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