Skip to content

aws configure sso leads to UnicodeEncodeError: 'idna' codec can't encode character '\x2e' in position 0: label empty #9402

@bdejong

Description

@bdejong

Describe the bug

This error occurs each time I try to aws configure sso. No matter what information I enter as values, I get this error. I tried with brew installed awscli (on Python 3.12), the official distribution (pkg), and straight from this repo, using version aws-cli/2.25.2 Python/3.13.2 Darwin/24.3.0 source/arm64.

I have also tried configuring the values in ~/.aws/config, but I get exactly the same error.

I have done some "print() debugging and it seems the input to the functions is sane (no weird characters):

{
  'session': <botocore.session.Session object at 0x10543be00>,
  'sso_region': 'eu-central-1',
  'start_url': 'https://holoplot.awsapps.com/start',
  'parsed_globals': Namespace(
    debug=True,
    endpoint_url=None,
    verify_ssl=None,
    paginate=True,
    output=None,
    query=None,
    profile=None,
    region=None,
    color='auto',
    sign_request=True,
    ca_bundle=None,
    read_timeout=60,
    connect_timeout=60,
    cli_binary_format=None,
    no_cli_pager=False,
    cli_auto_prompt=False,
    no_cli_auto_prompt=False,
    command='configure'),
  'token_cache': None,
  'on_pending_authorization': None,
  'force_refresh': True,
  'registration_scopes': ['sso:account:access'],
  'session_name': 'holo',
  'use_device_code': False}

I tried exactly the same on a (virtual) macOS fresh install and of it works perfectly.

Regression Issue

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

Expected Behavior

The opening of a browser window where I can do SSO auth.

Current Behavior

Traceback (most recent call last):
  File "/Users/bram.dejong/Documents/dev/_sandbox/aws-test/aws-cli/awscli/clidriver.py", line 510, in main
    return command_table[parsed_args.command](remaining, parsed_args)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bram.dejong/Documents/dev/_sandbox/aws-test/aws-cli/awscli/customizations/commands.py", line 155, in __call__
    return self._subcommand_table[subcommand_name](
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        new_args, parsed_globals
        ^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/bram.dejong/Documents/dev/_sandbox/aws-test/aws-cli/awscli/customizations/commands.py", line 209, in __call__
    rc = self._run_main(parsed_args, parsed_globals)
  File "/Users/bram.dejong/Documents/dev/_sandbox/aws-test/aws-cli/awscli/customizations/configure/sso.py", line 560, in _run_main
    sso_token = self._sso_login(
        self._session,
    ...<4 lines>...
        **sso_registration_args,
    )
  File "/Users/bram.dejong/Documents/dev/_sandbox/aws-test/aws-cli/awscli/customizations/sso/utils.py", line 101, in do_sso_login
    auth_code_fetcher=AuthCodeFetcher(),
                      ~~~~~~~~~~~~~~~^^
  File "/Users/bram.dejong/Documents/dev/_sandbox/aws-test/aws-cli/awscli/customizations/sso/utils.py", line 219, in __init__
    self.http_server = HTTPServer(('', 0), handler)
                       ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/socketserver.py", line 457, in __init__
    self.server_bind()
    ~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/server.py", line 138, in server_bind
    self.server_name = socket.getfqdn(host)
                       ~~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/socket.py", line 807, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
                                 ~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/encodings/idna.py", line 198, in encode
    raise UnicodeEncodeError("idna", input, offset, offset+1,
                             "label empty")
UnicodeEncodeError: 'idna' codec can't encode character '\x2e' in position 0: label empty
encoding with 'idna' codec failed

'idna' codec can't encode character '\x2e' in position 0: label empty```

### Reproduction Steps

`aws configure sso`

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CLI version used

2.25.2

### Environment details (OS name and version, etc.)

Python/3.13.2 Darwin/24.3.0 source/arm64

Metadata

Metadata

Labels

bugThis issue is a bug.closed-for-stalenessp2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.sso

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions