You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NameError in ParamUnknownKeyError due to undefined variable valid_key #10405
When the CLI attempts to raise a ParamUnknownKeyError (typically during map/shorthand validation), a NameError is thrown instead. This occurs due to a typo in awscli/argprocess.py (line 58), where valid_key is used instead of the locally defined valid_keys variable.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
The CLI should successfully format and raise a ParamUnknownKeyError, displaying a clear error message that lists the invalid key alongside the valid choices.
Current Behavior
A NameError is thrown because valid_key is not defined in the local scope, masking the intended CLI parsing error.
Traceback (most recent call last):
File "<string>", line 1, in <module>
from awscli.argprocess import ParamUnknownKeyError; ParamUnknownKeyError('BadKey', ['GoodKey1', 'GoodKey2'])
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kushagargargsmacbook/aws-cli/awscli/argprocess.py", line 58, in __init__
f"Unknown key '{key}', valid choices are: {valid_key}"
^^^^^^^^^
NameError: name 'valid_key' is not defined. Did you mean: 'valid_keys'?
Reproduction Steps
This bug can be cleanly isolated and reproduced directly by instantiating the error class in a Python REPL:
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.
Activity
Fix NameError in ParamUnknownKeyError formatting (#10406)
github-actions commentedon Jun 19, 2026
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.