Skip to content

AWS CLI v2.36.46 fails to start on Korean Windows when current-user install path contains non-ASCII characters #10645

Description

@heewon0704

Describe the bug

AWS CLI v2.36.46 fails immediately on Korean Windows when installed for the current user and the Windows user profile path contains Korean characters.

The AWS CLI was installed using the official PowerShell installer:
irm https://awscli.amazonaws.com/v2/install.ps1 | iex

The installation path is:
C:\Users\김희원(HeewonKim)\AppData\Local\Programs\Amazon\AWSCLIV2

After installation, even a simple command such as:
aws --version

fails with:
aws: [ERROR]: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequence

Image

The same error occurs with other commands, including:

aws login
aws --version --debug

The issue appears to be caused by the following file:
C:\Users\김희원(HeewonKim)\AppData\Local\Programs\Amazon\AWSCLIV2\awscli\data\install.json

The file contains the current-user installation path:

{
  "distribution_source": "script-exe",
  "install_dir": "C:\\Users\\김희원(HeewonKim)\\AppData\\Local\\Programs\\Amazon\\AWSCLIV2",
  "script_install": {
    "system": false,
    "version_resolved": "2.36.46",
    "quiet": false
  }
}

The file is valid UTF-8, but decoding it as CP949 fails at exactly the same byte position reported by the AWS CLI:

python -c "import sys; b=open(sys.argv[1],'rb').read(); print('UTF-8:', end=' '); b.decode('utf-8'); print('OK'); print('CP949:', end=' '); b.decode('cp949'); print('OK')" `
"C:\Users\김희원(HeewonKim)\AppData\Local\Programs\Amazon\AWSCLIV2\awscli\data\install.json"

Result:
UTF-8: OK

UnicodeDecodeError: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequence

This matches the AWS CLI error exactly:
'cp949' codec can't decode byte 0x80 in position 74

Renaming install.json so that AWS CLI cannot read it immediately resolves the issue:

Rename-Item `
  "$env:LOCALAPPDATA\Programs\Amazon\AWSCLIV2\awscli\data\install.json" `
  "install.json.bak"

aws --version

After renaming the file, aws --version works normally.

This suggests that AWS CLI is reading install.json using the Windows locale/default encoding (cp949) instead of explicitly reading the JSON file as UTF-8.

Regression Issue

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

Expected Behavior

AWS CLI should successfully start regardless of whether the current user's profile path contains non-ASCII characters.

For example:
aws --version

should return the installed AWS CLI version even when the installation path contains Korean characters.

Since install.json is written as UTF-8 JSON, AWS CLI should explicitly read it using UTF-8 rather than relying on the Windows system default encoding.

Current Behavior

AWS CLI terminates before processing any command:
aws: [ERROR]: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequence

The failure occurs for:

aws --version
aws --version --debug
aws login

Setting the following environment variables does not resolve the issue:

$env:PYTHONUTF8="1"
$env:AWS_CLI_FILE_ENCODING="UTF-8"
$env:AWS_CLI_OUTPUT_ENCODING="UTF-8"

The issue disappears when:
awscli\data\install.json

is renamed or otherwise made unavailable.

metadata.json does not have the same problem and can be decoded successfully using both UTF-8 and CP949.

Reproduction Steps

  1. Use a Korean Windows user account whose user profile directory contains Korean characters. For example:
    C:\Users\김희원(HeewonKim)

  2. Install AWS CLI v2.36.46 for the current user using the official PowerShell installer:
    irm https://awscli.amazonaws.com/v2/install.ps1 | iex

  3. Confirm that AWS CLI is installed under:
    %LOCALAPPDATA%\Programs\Amazon\AWSCLIV2

  4. Run:
    aws --version

  5. Observe:
    aws: [ERROR]: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequence

  6. Inspect the generated installation metadata:

Get-Content `
  "$env:LOCALAPPDATA\Programs\Amazon\AWSCLIV2\awscli\data\install.json" `
  -Raw -Encoding UTF8

The install_dir field contains the non-ASCII Windows username.

  1. Verify that the file is valid UTF-8 but cannot be decoded using CP949:
    $f = "$env:LOCALAPPDATA\Programs\Amazon\AWSCLIV2\awscli\data\install.json" python -c "import sys; b=open(sys.argv[1],'rb').read(); b.decode('utf-8'); print('UTF-8: OK'); b.decode('cp949'); print('CP949: OK')" $f
    This produces:
    UTF-8: OK UnicodeDecodeError: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequence

  2. Rename the file:
    Rename-Item "$env:LOCALAPPDATA\Programs\Amazon\AWSCLIV2\awscli\data\install.json" "install.json.bak"

  3. Run again:
    aws --version
    The command now works normally.

Possible Solution

No response

Additional Information/Context

No response

CLI version used

2.36.46

Environment details (OS name and version, etc.)

Microsoft Windows 11

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions