From 084c86d18847275a43c97721ebe46d7063d437c8 Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Sat, 12 Sep 2026 10:29:11 +0000 Subject: [PATCH] fix: Handle KeyError in CodecovOption fallback lookups --- codecov_cli/fallbacks.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codecov_cli/fallbacks.py b/codecov_cli/fallbacks.py index 099b391db..31dc0db68 100644 --- a/codecov_cli/fallbacks.py +++ b/codecov_cli/fallbacks.py @@ -50,14 +50,20 @@ def get_default( if self.fallback_fields is not None: for field in self.fallback_fields: if ctx.obj.get("ci_adapter") is not None: - res = ctx.obj.get("ci_adapter").get_fallback_value(field) + try: + res = ctx.obj.get("ci_adapter").get_fallback_value(field) + except KeyError: + res = None if res is not None: return res if ( ctx.obj.get("versioning_system") is not None and field in _FIELDS_WITH_VERSIONING_FALLBACK ): - res = ctx.obj.get("versioning_system").get_fallback_value(field) + try: + res = ctx.obj.get("versioning_system").get_fallback_value(field) + except KeyError: + res = None if res is not None: return res return None