Error handlers that take args: Args crash with a missing 'next' argument

オープン
#1,598 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@sahiljagtap08 がすでに取り組んでいます。

2026年10月8日 から。

  • #1592 @sahiljagtap08 による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

The crash comes from slack_bolt/kwargs_injection/utils.py in build_required_kwargs and its async twin in async_utils.py, where next is removed from the args before Args(**all_available_args) is built and arg_names.pop() shrinks the listener's list. Read both functions and reproduce with the snippet in the issue using an @app.error handler that takes args: Args. Done means the handler runs and logs the original RuntimeError in sync and async paths; a fix is already open as PR #1592, so review or extend that rather than starting a parallel one.

索引モデルが issue の本文から書いたものです。

説明

auto-triage-stale
Reproducible in:
The slack_bolt version
slack_bolt==1.30.0
slack_sdk==3.45.0
Python runtime version
Python 3.12.5
OS info
macOS 27.0
Steps to reproduce:

Register a global error handler that takes args: Args.

from slack_bolt import App, Args

app = App(token="xoxb-...", signing_secret="secret")

@app.error
def on_error(error, args: Args):
    args.logger.error(error)

@app.event("app_mention")
def boom(say):
    raise RuntimeError("original error")
  1. Trigger the app_mention event.
Expected result:

on_error runs and logs original error.

Actual result:

The error handler itself crashes before it runs:

TypeError: Args.__init__() missing 1 required positional argument: 'next'

The original RuntimeError is lost. In slack_bolt/kwargs_injection/utils.py (build_required_kwargs) and async_utils.py, next is removed from the available arguments for error handlers, but Args(**all_available_args) is then built from that reduced dict, and Args requires next. The same code also uses arg_names.pop() on the listener's own list, so the list shrinks on every call.

I have a fix with sync and async tests in #1592. It also adds an error field to Args so error handlers can read the exception through args.

Requirements

I have read the Contributing guidelines and Code of Conduct.

主要言語
Python
スター
1.3k
フォーク
300
平均マージ
19時間 33分
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

slackapi/bolt-python のほかの issue

slackapi/bolt-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。