Skip to content

fix: prevent AttributeError when ctx.obj is None in CodecovOption.get_default - #768

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-gg-none-ctx-obj
Open

fix: prevent AttributeError when ctx.obj is None in CodecovOption.get_default#768
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-gg-none-ctx-obj

Conversation

@sentry

@sentry sentry Bot commented Aug 22, 2026

Copy link
Copy Markdown

This PR addresses an AttributeError: 'NoneType' object has no attribute 'get' that occurred when running codecov-cli --help or codecov-cli <command> --help.

The root cause was that Click's help rendering mechanism calls CodecovOption.get_default before the ctx.obj (which holds ci_adapter, versioning_system, etc.) is fully initialized. This resulted in ctx.obj being None when the code attempted to call .get() on it.

The fix adds a check for ctx.obj is not None in codecov_cli/fallbacks.py within the CodecovOption.get_default method. This ensures that the fallback logic, which relies on ctx.obj, is only executed when ctx.obj is a valid object, thus preventing the AttributeError.

Fixes CLI-GG

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

@codecov

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