Skip to content

TypeError: aiogram.dispatcher.router.Router.emit_startup() got multiple values for keyword argument 'bot' #1242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arynyklas opened this issue Aug 2, 2023 · 2 comments · Fixed by #1247

Comments

@arynyklas
Copy link

Expected Behavior

Successful startup of Dispatcher.start_polling

Current Behavior

TypeError: aiogram.dispatcher.router.Router.emit_startup() got multiple values for keyword argument 'bot'

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. dispatcher.start_polling(bot)

Failure Logs

Traceback (most recent call last):
  File "...lib\site-packages\aiogram\dispatcher\dispatcher.py", line 519, in start_polling
    await self.emit_startup(bot=bots[-1], **workflow_data)
TypeError: aiogram.dispatcher.router.Router.emit_startup() got multiple values for keyword argument 'bot'
@JrooTJunior
Copy link
Member

Did you pass the "bot" key into dispatcher.workflow_data?

With described scenario in the "Steps to reproduce" section it can't be reproduced, but if you set manually dispatcher.workflow_data["bot"] = bot this error can be caused.

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Aug 5, 2023

It also may looks like a

dispatcher["bot"] = ...

Since Dispatcher has:

def __setitem__(self, key: str, value: Any) -> None:
    self.workflow_data[key] = value

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 a pull request may close this issue.

3 participants