diff --git a/.sampo/changesets/forthright-seer-otso.md b/.sampo/changesets/forthright-seer-otso.md new file mode 100644 index 00000000..bcaf975e --- /dev/null +++ b/.sampo/changesets/forthright-seer-otso.md @@ -0,0 +1,5 @@ +--- +pypi/posthog: patch +--- + +Add warning log for local flag evaluation cold start diff --git a/posthog/client.py b/posthog/client.py index 4de95581..0157b1df 100644 --- a/posthog/client.py +++ b/posthog/client.py @@ -1620,7 +1620,13 @@ def _get_feature_flag_result( self.flag_cache.set_cached_flag( distinct_id, key, flag_result, self.flag_definition_version ) - elif not only_evaluate_locally: + elif only_evaluate_locally: + if self.feature_flags is None: + self.log.warning( + "[FEATURE FLAGS] Local evaluation called but feature flag definitions are not loaded yet. " + "Returning None. You can call load_feature_flags() to load flags explicitly." + ) + else: try: flag_details, request_id, evaluated_at, errors_while_computing = ( self._get_feature_flag_details_from_server(