Skip to content

fix(slack): Guard against NoneType selected_option in action webhooks#116163

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/slack-action-none-selected-option
Draft

fix(slack): Guard against NoneType selected_option in action webhooks#116163
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/slack-action-none-selected-option

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 26, 2026

This PR fixes a TypeError: 'NoneType' object is not subscriptable occurring in src/sentry/integrations/slack/webhooks/action.py within the get_action_list method.

The root cause was that for Slack static_select and external_select action types, the code unconditionally attempted to subscript action_data['selected_option'] and its nested keys. However, Slack can send payloads where selected_option is None or missing (e.g., when a user opens or clears a select menu without making a selection), leading to the TypeError.

The fix involves:

  • Safely retrieving selected_option using .get() and verifying it is a dictionary.
  • If selected_option is None or not a dictionary, the specific action is now skipped, and an informational log (slack.action.missing_selected_option) is emitted to aid future debugging without crashing.
  • All subsequent accesses to selected_option's nested keys (like text.text and value) now use .get() to prevent similar errors if those sub-keys are also missing.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-3ZYV

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants