Skip to content

fix: leave updates of an unknown type to aiogram - #59

Merged
lesnik512 merged 1 commit into
mainfrom
fix/unknown-update-type
Oct 17, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
fix/unknown-update-type

Conversation

@lesnik512

Copy link
Copy Markdown
Member

With setup_di, an update whose type aiogram does not know raised UpdateTypeLookupError out of feed_update. Without DI, aiogram warns "Detected unknown update type" and returns UNHANDLED (Dispatcher._listen_update). The DI middleware wraps the dispatcher's update handling and read update.event to fill the child container's context, so it raised before aiogram's handler ever got to its own check.

This happens whenever Telegram adds an update type the installed aiogram does not know yet. Under polling, each such update logged an error traceback. Under a webhook with handle_in_background=False, feed_webhook_update re-raised, so Telegram got an error response and redelivered the update.

Update still always goes into the child's context. TelegramObject is now added only when update.event resolves, so for an unknown type the middleware passes the update on and aiogram warns and returns UNHANDLED as it does without DI.

The new test feeds Update(update_id=1) and expects aiogram's warning and UNHANDLED. On main it fails with UpdateTypeLookupError.

@lesnik512
lesnik512 merged commit d3c158f into main Oct 17, 2026
12 checks passed
@lesnik512
lesnik512 deleted the fix/unknown-update-type branch October 17, 2026 18:00
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 this pull request may close these issues.

1 participant