GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: error handlers that take args: Args crashed instead of running by sahiljagtap08 · Pull Request #1592 · slackapi/bolt-python

Conversation

@sahiljagtap08

@sahiljagtap08 sahiljagtap08 commented Oct 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

An error handler declared as def handler(args: Args) never ran. Error handlers, listener start/completion handlers, and middleware error handlers all build their kwargs with next_keys_required=False. That removed next and next_ from the available arguments, but Args.__init__ requires next, so building the Args object raised:

TypeError: Args.__init__() missing 1 required keyword-only argument: 'next'

The handler was skipped and the original listener error was lost with it. The async variant had the same problem.

Changes:

  • slack_bolt/kwargs_injection/utils.py and async_utils.py: next and next_ stay in the available arguments so Args can be built. They are only left out when injecting direct keyword arguments for handlers that have no middleware chain, which keeps the existing behaviour for those handlers.
  • slack_bolt/kwargs_injection/args.py and async_args.py: add an optional error field so an error handler can read the exception through args.error. The value was already passed to the constructor but was dropped by **kwargs.

Testing

Added test_custom_with_args to both tests/scenario_tests/test_error_handler.py and tests/scenario_tests_async/test_error_handler.py. Each registers an error handler that takes args: Args, reads args.error, and sets a response header. Both fail on main and pass with this change. Ran ./scripts/format.sh, ./scripts/lint.sh, ./scripts/run_mypy.sh, the error handler test files, the kwargs injection tests, and the middleware tests.

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Others

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

Fixes #1598

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sahiljagtap08
fix: error handlers that take args: Args crashed instead of running
605fcc8
Error handlers, listener start/completion handlers and middleware error
handlers build their kwargs with next_keys_required=False, which removed
next/next_ from the available args. Args.__init__ requires next, so a
handler declared as (args: Args) raised TypeError and never ran. The
original error was then lost.

- Keep next/next_ available for building Args and only skip injecting
  them as direct kwargs when there is no middleware chain
- Add an error field to Args and AsyncArgs so error handlers can read
  the exception through args
- Add sync and async tests for an error handler that takes args
@sahiljagtap08
sahiljagtap08 requested a review from a team as a code owner October 8, 2026 21:49
@salesforce-cla salesforce-cla Bot added the cla:signed label Oct 8, 2026
@sahiljagtap08 sahiljagtap08 mentioned this pull request Oct 9, 2026
Error handlers that take args: Args crash with a missing 'next' argument #1598
Open

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla:signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@sahiljagtap08
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.