Troubleshooting
aiogram: TypeError: object dict can't be used in 'await' expression
TypeError: object dict can't be used in 'await' expression
Symptom
TypeError: object dict can't be used in 'await' expression
StateStore.get_user_wallets() takes 1 positional argument but 2 were given
Cause A handler awaits a synchronous method (returns dict
) and/or the StateStore.get_user_wallets
signature does not accept a user_id
argument.
Fix
Make
get_user_wallets
eitherasync def ...
returning an awaitable, or stop awaiting it.Ensure the signature matches usage:
def get_user_wallets(self, user_id: int) -> dict: ...
Audit all state store calls (
add_wallet
,set_active_wallet
, etc.) for consistentself, user_id
ordering.
WebSocket stalls after months of uptime
Rotate Alchemy WS URLs and enable heartbeat/ping logic in the provider.
Add exponential backoff on reconnect (
tenacity
) and guard re‑subscription logic.
Bot appears unresponsive in busy groups
Verify the bot is admin before prompting multi‑step flows.
Consider offering a private setup path (DM) to avoid message storms.
...
placeholders in code
...
placeholders in codeSome modules include ...
to redact private logic. Extend these blocks with your concrete implementations (DEX calls, signing routines). The public APIs and call points documented here remain stable.