Troubleshooting¶
Find what you saw: something on Discord, a line in the bot's log, or an exception in your code. Each entry says
what causes it and links the page that explains it in full. The library's quieter lines, such as a dropped click,
log at DEBUG, which setup_logging(level="DEBUG") shows.
On Discord¶
"Your bot didn't respond in time"¶
Discord shows this in red under the message, with your bot's name, when nothing answers a click within 3 seconds. Older versions of Discord said "This interaction failed". CascadeUI answers every click for you: a quick callback's redraw is the answer, and a callback still running at 2.5 seconds has its click acknowledged.
When it still appears, the cause is one of these:
auto_defer = False. The 3 seconds belong to your callback, which has to answer. See Changing the Defaults.- Code that blocks the event loop, such as heavy computation or a synchronous database call, holds up the
2.5-second timer with everything else. Await the slow call, or set
ack_first = True. See Timing Settings. - Many clicks queued on one view. Each waits its turn, and an acknowledgement that reaches Discord late still fails, although the callback runs. See the notes under Changing the Defaults.
- A slow Discord. When Discord is slow to accept the answer itself, no setting helps. See When the Answer Is Slow Too.
- A panel nothing runs anymore. A panel sent before the bot restarted has no view behind it unless it is persistent: discord.py drops the click, and nothing answers. A private panel whose view closed after its 15 minutes keeps buttons that fail the same way.
- A dynamic button that cannot be rebuilt from its id, such as one with letters in a group named for an id. discord.py logs the error. See Template Rules.
A Click That Does Nothing¶
The library answered the click without running its callback, and logged why at DEBUG:
The click was a second click while the person's first was still running
(Double Clicks), it was sent from an older screen for a control the view has
since disabled or removed, or the view had closed. A counter that misses quick clicks needs
allow_double_click=True.
Where to Look shows how to follow a click further.
"You cannot interact with this."¶
The panel answers only its owner (owner_only, on by default) or the people in allowed_users. Set
owner_only = False to open it to everyone, or list who may click. See Who May Click,
and Changing the Refusal for other words.
"This session is full."¶
The owner and the players already joined fill participant_limit. See
Capping the Number of Players.
"You already have one of these open. Close it first."¶
The view's instance_limit refused a new panel: under instance_policy = "reject", or under "replace" when the
panels filling the count are not this person's to replace. The words follow the limit and its scope, such as
"One of these is already open in this server." See
When the Limit Is Reached.
The Old Panel Disappeared¶
A view with an instance_limit and the default instance_policy = "replace" closes the person's oldest panel to
make room, and the default replace_policy = "delete" deletes its message. "disable" leaves it in place, closed.
See When the Limit Is Reached.
"Something went wrong"¶
A private red card with this title, reading "An unexpected error occurred while processing your interaction.",
means the callback raised. The log holds the traceback at ERROR, starting Error in <item> of view <Class>:.
See When a Callback Raises.
The Buttons Turned Grey¶
The view closed. By default it times out 180 seconds after its last click or edit. Set a longer timeout, or
timeout=None. See Timeout and
What a Closed Panel Looks Like.
Only a Continue Button¶
A private panel meant to outlast Discord's 15-minute limit is replaced by a Continue button once 13.5 minutes pass without a click, and a click brings the panel back on the same message. See The Continue Button.
"This session has ended."¶
A modal was submitted, or a with_confirmation Yes clicked, after the view that opened it closed. A submission
still ran: see When the View Closes First.
"Could not refresh this view. Try again, or reopen it from the original command."¶
The panel did not come back at a Continue: on_load() or its redraw raised (the log holds the error), or
Discord refused the edit. The Continue button stays, so clicking it again tries again. See
When the Continue Fails.
"This form is no longer open. Please open it again."¶
A modal opened for one person was submitted by someone else, which modals sharing a fixed custom_id allow. See
Modals and Inputs.
Buttons Stop Working After a Restart¶
Only a persistent panel comes back. A click on any other panel sent before the restart fails with "your bot didn't respond in time". For a persistent panel that still does not answer, check that:
- persistence is installed with
bot=insetup_hook(Setup) - every control has a
custom_id(Requirements) - the cog defining the panel's class loads before
setup_middleware(), orget_store().persistence_manager.reattach()runs after it loads (Panels Loaded Later)
/cascadeui unreachable lists the panels whose message could not be reached (Where to Look).
An Image Does Not Show¶
A panel names an upload as attachment://<name>, and the file has to travel with every send and edit that names
it. Discord refuses a request whose components name a missing file, and an embed image naming one shows nothing.
Return the files from get_files() and every request the library makes carries them. See
Uploading a File
and Files the View Supplies.
The Panel Updates a Moment Late¶
Discord was slow to accept the redraw, and the library sent it again once the click was acknowledged. See A Click Updates Late.
A Command Does Not Appear¶
A slash command reaches Discord through await bot.tree.sync(), as in
The Whole File. A typed ! command needs the message content intent:
intents.message_content = True, with the intent switched on in the Discord Developer Portal
(Send It From a Command).
In the Log¶
Dropped a click on ...¶
DEBUG. See A Click That Does Nothing.
No reducer found for action type ...¶
WARNING. An action was dispatched that no reducer handles and nothing listens for, most often a misspelled
type. See Action History.
Overwriting existing reducer for action type ...¶
WARNING. A second @cascade_reducer for the same type replaced the first. See
Custom Reducers.
Acting-view fast path exceeded ...¶
INFO. See The Panel Updates a Moment Late and
Watching for It.
... attachment reference(s) have no matching discord.File in this send¶
WARNING. See An Image Does Not Show.
Error in <item> of view <Class>: ...¶
ERROR, with the traceback. See "Something went wrong".
In Your Code¶
TypeError or ValueError When a Class Is Defined¶
A class attribute or argument holds a value the library refuses, such as a misspelled instance_policy. The
message names the class, the attribute, and the fix. See Wrong Input.
ValueError at send() or refresh()¶
The panel's component tree breaks one of Discord's rules, and the library refused it before anything was sent. The message names the component and the fix. See When a Tree Is Refused.
RuntimeError From a Call¶
A call was made where it cannot run, such as reload() from the view's own on_load(). The message names the call
and the fix. See Calls From the Wrong Place.
RuntimeError: ... needs UndoMiddleware¶
undo() or redo() ran with no UndoMiddleware installed. Install it in setup_hook with
await setup_middleware(UndoMiddleware()). See Undo Middleware.
InstanceLimitError¶
An instance limit refused a view that has no interaction or command to answer, such as one sent to a channel, or
an on_instance_limit() override raised it. A view with either replies to the person instead, and send() returns
None. See InstanceLimitError.
PersistenceInitError¶
Persistence could not start, for example with aiosqlite missing (pip install "pycascadeui[sqlite]"). See
Persistence Errors.
discord.HTTPException 400¶
Discord refused something no check catches first, and the error names the field. The rows of Discord Limits marked "Discord" are those limits.
Related¶
- DevTools: the commands that look further
- Known Limitations: what the library cannot change
- Reference: Errors: every exception the library raises