The Fix
Upgrade to version 2.2.0 or later.
Based on closed pallets/flask issue #4715 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -92,6 +92,12 @@ Unreleased
- When type checking, allow ``TypedDict`` to be returned from view
functions. :pr:`4695`
+- Remove the ``--eager-loading/--lazy-loading`` options from the
+ ``flask run`` command. The app is always eager loaded the first
+ time, then lazily loaded in the reloader. The reloader always prints
Option A — Upgrade to fixed release\nUpgrade to version 2.2.0 or later.\nWhen NOT to use: This fix is not suitable if you require the ability to toggle loading behavior for specific use cases.\n\n
Why This Fix Works in Production
- Trigger: There shouldn't be a reason now to control loading. Errors will always be shown immediately in the terminal when a command is run. Lazy loading should always…
- Mechanism: The CLI previously allowed toggling between lazy and eager loading, causing confusion with error visibility
- Why the fix works: Removes the `--eager-loading/--lazy-loading` options from the `flask run` command, ensuring the app is always eagerly loaded first and only lazily loaded on reloads. (first fixed release: 2.2.0).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- The CLI previously allowed toggling between lazy and eager loading, causing confusion with error visibility
- Production symptom (often without a traceback): There shouldn't be a reason now to control loading. Errors will always be shown immediately in the terminal when a command is run. Lazy loading should always be used within the reloader to handle errors.
Proof / Evidence
- GitHub issue: #4715
- Fix PR: https://github.com/pallets/flask/pull/4718
- First fixed release: 2.2.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.71
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“When the CLI was first introduced, it would always lazily load the application, and then resolve that lazy import the first time the app was needed. For the run command, in debug mode, that would be _after_ the server started, so that error”
Failure Signature (Search String)
- There shouldn't be a reason now to control loading. Errors will always be shown immediately in the terminal when a command is run. Lazy loading should always be used within the
Copy-friendly signature
Failure Signature
-----------------
There shouldn't be a reason now to control loading. Errors will always be shown immediately in the terminal when a command is run. Lazy loading should always be used within the reloader to handle errors.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
There shouldn't be a reason now to control loading. Errors will always be shown immediately in the terminal when a command is run. Lazy loading should always be used within the reloader to handle errors.
What Broke
Errors would not show immediately when running commands, leading to confusion during development.
Why It Broke
The CLI previously allowed toggling between lazy and eager loading, causing confusion with error visibility
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 2.2.0 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/pallets/flask/pull/4718
First fixed release: 2.2.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if you require the ability to toggle loading behavior for specific use cases.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 2.2.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.