Repository navigation
[BUG] 4.2.0rc3 failure to lanch with flask run: ValueError: The name '_dash_assets' is already registered for a different blueprint. #3787
Copy link
Copy link
Closed
Description
We have a proper running Dash 4.1 application. Upon testing 4.2.0rc3 and starting the application with flask run we were greeted with: ValueError: The name '_dash_assets' is already registered for a different blueprint. Use 'name=' to provide a unique name.
Full stack:
(venv) PS C:\Users\user\Python\dash-site> flask run
2026-05-14 13:39:02 - INFO - Settings class: dash.config.LocalDevelopmentConfig
2026-05-14 13:39:03 - INFO - Database URI: sqlite:///C:\Users\user\Python\dash-site\instance\dwsc.sqlite3
2026-05-14 13:39:06 - CRITICAL - Uncaught exception
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\user\Python\dash-site\venv\Scripts\flask.exe\__main__.py", line 5, in <module>
sys.exit(main())
~~~~^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\cli.py", line 1131, in main
cli.main()
~~~~~~~~^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\click\core.py", line 1435, in main
rv = self.invoke(ctx)
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\click\core.py", line 1902, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\click\core.py", line 1298, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\click\core.py", line 853, in invoke
return callback(*args, **kwargs)
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\click\decorators.py", line 93, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\click\core.py", line 853, in invoke
return callback(*args, **kwargs)
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\cli.py", line 979, in run_command
raise e from None
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\cli.py", line 963, in run_command
app: WSGIApplication = info.load_app() # pyright: ignore
~~~~~~~~~~~~~^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\cli.py", line 349, in load_app
app = locate_app(import_name, name)
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\cli.py", line 262, in locate_app
return find_best_app(module)
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\cli.py", line 72, in find_best_app
app = app_factory()
File "C:\Users\user\Python\dash-site\dash\__init__.py", line 180, in create_app
dash_app.init_app(app)
~~~~~~~~~~~~~~~~~^^^^^
File "C:\Users\user\Python\dash-site\dash\dash_app.py", line 505, in init_app
app.init_app(server)
~~~~~~~~~~~~^^^^^^^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\dash\dash.py", line 734, in init_app
self.backend.register_assets_blueprint(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
assets_blueprint_name,
^^^^^^^^^^^^^^^^^^^^^^
config.routes_pathname_prefix + self.config.assets_url_path.lstrip("/"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.config.assets_folder,
^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\dash\backends\_flask.py", line 95, in register_assets_blueprint
self.server.register_blueprint(bp)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\sansio\scaffold.py", line 47, in wrapper_func
return f(self, *args, **kwargs)
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\sansio\app.py", line 595, in register_blueprint
blueprint.register(self, options)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Users\user\Python\dash-site\venv\Lib\site-packages\flask\sansio\blueprints.py", line 310, in register
raise ValueError(
...<3 lines>...
)
ValueError: The name '_dash_assets' is already registered for a different blueprint. Use 'name=' to provide a unique name.
(venv) PS C:\Users\user\Python\dash-site>I realize this is not a MRE. If this is needed to troubleshoot, I can invest the time to try to create one.
Metadata
Metadata
Assignees
Labels
No labels
Activity
AnnMarieW commentedon May 16, 2026
@ghaarsma
Thanks for reporting - a MRE would be very helpful.
This error is likely caused by initializing Dash twice (or more) against the same Flask instance.
ghaarsma commentedon May 18, 2026
I have attached an MRE, in zip format. When running with Dash 4.1.0 all works fine
Then swap to Dash 4.2.0rc3 in the pyproject.toml and run
pip install .Then run
flask runagainNote that
flask runis not the only way it fails.flask --app dash_test runwill also fail.dash_test.zip
T4rk1n commentedon May 19, 2026
For this pattern to work properly, you need to init dash with server=False. eg:
This is the relevant docstring explaining the behavior:
dash/dash/dash.py
Lines 240 to 244 in d2b77b0
That being said, someone could put a safeguard to init_app to prevent such issues.
ghaarsma commentedon May 19, 2026
Hi @T4rk1n , Thank you for the help. I have implemented your suggested fix
server=Falsein the Dash call in both Dash 4.1 and Dash 4.2.0rc3Using the MRE with Dash 4.1 and
server=Falseeverything works as it should.With Dash 4.2.0.rc3 and 'server=False`, the reported
ValueError: The name '_dash_assets' is already registered for a different blueprint.goes away, but now the Flask/Dash server will not serve up the page. Everything is returning a 404 Not Found HTTP error.