Skip to content

fix: gracefully handle missing files during coverage upload - #778

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/upload-collector-filenotfound
Open

fix: gracefully handle missing files during coverage upload#778
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/upload-collector-filenotfound

Conversation

@sentry

@sentry sentry Bot commented Aug 27, 2026

Copy link
Copy Markdown

This PR addresses an issue where the codecov-cli would crash with a FileNotFoundError during a coverage upload if a file tracked by git was not present on the local filesystem. This commonly occurs with generated files (e.g., *.g.dart in Flutter projects) that are committed to version control but might not be generated in a specific local environment.

The root cause was that the _get_file_fixes function in codecov_cli/services/upload/upload_collector.py attempted to open such files without handling FileNotFoundError.

This fix adds an except FileNotFoundError block to _get_file_fixes. Now, if a git-tracked file is not found on disk, a warning will be logged, and the file will be skipped, allowing the coverage upload process to complete without interruption. This approach aligns with the existing error handling for UnicodeDecodeError and IsADirectoryError in the same function.

Fixes CLI-GS

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@codecov

codecov Bot commented Aug 27, 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 1726 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