Skip to content

Commit 11de8af

Browse files
azulusclaude
andcommitted
fix(seer): Guard token creation against None/AnonymousUser
create_explorer_api_token expects a real user, but self.user can be None or AnonymousUser. Skip token creation in those cases. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 593d1b1 commit 11de8af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sentry/seer/explorer/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ def start_run(
273273
user_auth_token = (
274274
create_explorer_api_token(self.user, self.organization)
275275
if self.enable_code_mode_tools
276+
and self.user
277+
and not isinstance(self.user, AnonymousUser)
276278
else None
277279
)
278280

@@ -380,6 +382,8 @@ def continue_run(
380382
user_auth_token = (
381383
create_explorer_api_token(self.user, self.organization)
382384
if self.enable_code_mode_tools
385+
and self.user
386+
and not isinstance(self.user, AnonymousUser)
383387
else None
384388
)
385389

0 commit comments

Comments
 (0)