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
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
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
-
Use a Korean Windows user account whose user profile directory contains Korean characters. For example:
C:\Users\김희원(HeewonKim)
-
Install AWS CLI v2.36.46 for the current user using the official PowerShell installer:
irm https://awscli.amazonaws.com/v2/install.ps1 | iex
-
Confirm that AWS CLI is installed under:
%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2
-
Run:
aws --version
-
Observe:
aws: [ERROR]: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequence
-
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.
-
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
-
Rename the file:
Rename-Item "$env:LOCALAPPDATA\Programs\Amazon\AWSCLIV2\awscli\data\install.json" "install.json.bak"
-
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
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 | iexThe installation path is:
C:\Users\김희원(HeewonKim)\AppData\Local\Programs\Amazon\AWSCLIV2After installation, even a simple command such as:
aws --versionfails with:
aws: [ERROR]: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequenceThe same error occurs with other commands, including:
The issue appears to be caused by the following file:
C:\Users\김희원(HeewonKim)\AppData\Local\Programs\Amazon\AWSCLIV2\awscli\data\install.jsonThe file contains the current-user installation path:
The file is valid UTF-8, but decoding it as CP949 fails at exactly the same byte position reported by the AWS CLI:
Result:
UTF-8: OKUnicodeDecodeError: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequenceThis matches the AWS CLI error exactly:
'cp949' codec can't decode byte 0x80 in position 74Renaming
install.jsonso that AWS CLI cannot read it immediately resolves the issue:aws --versionAfter renaming the file,
aws --versionworks normally.This suggests that AWS CLI is reading
install.jsonusing the Windows locale/default encoding (cp949) instead of explicitly reading the JSON file as UTF-8.Regression Issue
Expected Behavior
AWS CLI should successfully start regardless of whether the current user's profile path contains non-ASCII characters.
For example:
aws --versionshould return the installed AWS CLI version even when the installation path contains Korean characters.
Since
install.jsonis 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 sequenceThe failure occurs for:
Setting the following environment variables does not resolve the issue:
The issue disappears when:
awscli\data\install.jsonis 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
Use a Korean Windows user account whose user profile directory contains Korean characters. For example:
C:\Users\김희원(HeewonKim)Install AWS CLI v2.36.46 for the current user using the official PowerShell installer:
irm https://awscli.amazonaws.com/v2/install.ps1 | iexConfirm that AWS CLI is installed under:
%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2Run:
aws --version
Observe:
aws: [ERROR]: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequenceInspect the generated installation metadata:
The install_dir field contains the non-ASCII Windows username.
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')" $fThis produces:
UTF-8: OK UnicodeDecodeError: 'cp949' codec can't decode byte 0x80 in position 74: illegal multibyte sequenceRename the file:
Rename-Item"$env:LOCALAPPDATA\Programs\Amazon\AWSCLIV2\awscli\data\install.json""install.json.bak"Run again:
aws --versionThe 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