Closed
Description
Describe your context
dash 3.1.0
Describe the bug
In dash==3.1.0
, multi-page app fails when suppress_callback_exceptions=True
. This issue does not occur in dash==3.0.4
or when the flag is unset (because it defaults to False
).
Here's the minimal reproducible example:
import dash
from dash import Dash, html
print(dash.__version__) # 3.1.0
app = Dash(
use_pages=True,
pages_folder="",
suppress_callback_exceptions=True,
)
dash.register_page("/", layout=lambda: html.H1("Homepage"))
app.layout = html.Div([
dash.page_container,
])
app.run(debug=True)
Error message:
File "/lib/python3.12/site-packages/dash/dash.py", line 2497, in router
if not isinstance(layout, list):
^^^^^^
UnboundLocalError: cannot access local variable 'layout' where it is not associated with a value
Screenshots
Screen.Recording.2025-06-27.at.13.04.23.mov
Other
It looks like the bug comes from this PR and the following change (can't send the direct link to the code section as the PR introduced many changes):

Metadata
Metadata
Assignees
Labels
No labels