Skip to content

fix: add missing parameters to posthog on_error callback#4930

Open
karesansui-u wants to merge 1 commit intoAider-AI:mainfrom
karesansui-u:fix/posthog-on-error-args
Open

fix: add missing parameters to posthog on_error callback#4930
karesansui-u wants to merge 1 commit intoAider-AI:mainfrom
karesansui-u:fix/posthog-on-error-args

Conversation

@karesansui-u
Copy link
Copy Markdown

Bug description

Posthog's consumer thread calls on_error(error, batch) with two positional arguments, but Analytics.posthog_error() only accepts self.

When a Posthog error occurs (network failure, server error, etc.):

  1. on_error(error, batch) is called with 2 args
  2. posthog_error(self) receives 3 positional args (self + error + batch)
  3. TypeError is raised inside Posthog's consumer thread
  4. self.ph = None never executes — Posthog is never disabled
  5. Failed requests continue to be retried indefinitely

Fix

Accept the two optional parameters that Posthog passes:

def posthog_error(self, error=None, batch=None):

Also removes a print("X" * 100) debug statement that was left in.

References

Affected files

  • aider/analytics.py (L206) — 1 line change

Posthog's consumer calls on_error(error, batch) with two arguments, but
posthog_error() only accepts self. This causes a TypeError in the error
handler, preventing self.ph = None from executing. As a result, Posthog
is never disabled on errors and keeps retrying failed requests.

Also removes a debug print statement that was left in.
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.

1 participant