UnicodeDecodeError in detect-aws-credentials is unreadable
See original GitHub issueDetect AWS Credentials...................................................Failed
hookid: detect-aws-credentials
Traceback (most recent call last):
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
sys.exit(main())
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
bad_filenames = check_file_for_aws_keys(args.filenames, keys)
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
text_body = content.read()
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 103: invalid continuation byte
Traceback (most recent call last):
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
sys.exit(main())
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
bad_filenames = check_file_for_aws_keys(args.filenames, keys)
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
text_body = content.read()
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 2346: invalid start byte
Traceback (most recent call last):
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
sys.exit(main())
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
bad_filenames = check_file_for_aws_keys(args.filenames, keys)
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
text_body = content.read()
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 187: invalid continuation byte
Traceback (most recent call last):
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
sys.exit(main())
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
bad_filenames = check_file_for_aws_keys(args.filenames, keys)
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
text_body = content.read()
File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 167: invalid continuation byte
It rejected the commit, so that’s good. And I’m not sure if I can recommend any improvements to the handling of invalid unicode since I haven’t looked at the code in this module.
But for sure this error message could be more useful. There are 773 files in this commit and it would sure be nice to know which one(s) have this problem.
Edit: Ideally if there’s an exception it would continue to the next file so all the files that couldn’t be processed can be listed to the user before the commit is rejected. I’m not looking forward to fixing one file, doing git commit
, fixing another… 500 times. 😉
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:20 (11 by maintainers)
Top Results From Across the Web
AWS UnicodeDecodeError when creating application on ...
I'd like to re-enter the credentials but it seems they are cached somewhere (it asked me for them on the first install attempt...
Read more >UnicodeDecodeError utf-8 codec can t decode byte 0xba in ...
I am trying to read one CSV file in my jupyter notebook using pandas, but it shows me Unicode error. How can I...
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
UTF-8 - UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 27: ... Bug:427492 - "dev-ruby/aws-sdk-1.5.7: fails tests" status:RESOLVED ...
Read more >Release Notes | Google Cloud CLI Documentation
This enables using executable-sourced credentials with user interactivity with gcloud auth login --cred-file=/path/to/interactive/executable/config.json ...
Read more >CentOS-7
2022-09-17, Latest AWS AMI for CentOS 7 does not support new instance types ... 2022-03-17, lsblk fails to detect btrfs volumes on certain...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After fixing plist detection (via
identify>=1.2.0
) that passes now 🎉I decided to pick this up in #453