Skip to content

fix: Prevent UnicodeDecodeError from non-UTF-8 git paths - #751

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/git-output-encoding
Open

fix: Prevent UnicodeDecodeError from non-UTF-8 git paths#751
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/git-output-encoding

Conversation

@sentry

@sentry sentry Bot commented Aug 2, 2026

Copy link
Copy Markdown

This PR addresses a UnicodeDecodeError that occurred when codecov-cli attempted to decode git command output containing non-UTF-8 bytes, particularly in filenames or branch names.

The root cause was identified as the use of bare .decode() calls (which default to strict UTF-8) on subprocess.run stdout, leading to crashes when encountering invalid byte sequences (e.g., 0xc0).

The fix involves updating all relevant .decode() calls in codecov_cli/helpers/versioning_systems.py to explicitly use decode("utf-8", errors="surrogateescape"). This standard Python idiom for handling filesystem paths ensures that non-UTF-8 bytes are preserved as surrogate characters instead of raising an exception, allowing the CLI to gracefully process repositories with such names.

Fixes CLI-BD

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
723 1 722 1
View the full list of 1 ❄️ flaky test(s)
api.temp.calculator.test_calculator::test_divide

Flake rate in main: 100.00% (Passed 0 times, Failed 1625 times)

Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants