The Fix
Upgrade to version 1.1.2 or later.
Based on closed pallets/flask issue #3430 · 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%.
@@ -10,6 +10,9 @@ Unreleased
loaders, such as ``toml.load`` or ``json.load``.
:meth:`Config.from_json` is deprecated in favor of this. :pr:`3398`
+- The ``flask run`` command will only defer errors on reload. Errors
+ present during the initial call will cause the server to exit with
+ the traceback immediately. :issue:`3431`
import flask
app = flask.Flask(__nam__) # <<< TYPO!!!
@app.route('/')
def index():
return flask.make_response({"foo": 42}, 200)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 1.1.2 or later.\nWhen NOT to use: This fix is not suitable for applications that require immediate feedback on startup errors.\n\nOption C — Workaround\nfor this feature: `flask run --eager-loading`. Perfect! Nothing to fix here, right?\nWhen NOT to use: This fix is not suitable for applications that require immediate feedback on startup errors.\n\n
Why This Fix Works in Production
- Trigger: In my perfect world, a bug in the app factory would cause an immediate crash on startup. But since delaying such crashes was clearly added deliberately to…
- Mechanism: Flask's lazy loading feature prevents immediate crash on startup for import-time errors
- Why the fix works: Modifies the behavior of the `flask run` command to only defer errors on reload, ensuring that initial errors are reported immediately. (first fixed release: 1.1.2).
- 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
- Flask's lazy loading feature prevents immediate crash on startup for import-time errors
- Production symptom (often without a traceback): In my perfect world, a bug in the app factory would cause an immediate crash on startup. But since delaying such crashes was clearly added deliberately to Flask, and has been there for 5 years, I do NOT propose changing this behaviour.
Proof / Evidence
- GitHub issue: #3430
- Fix PR: https://github.com/pallets/flask/pull/3434
- First fixed release: 1.1.2
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.62
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“The point of lazy loading is that the dev server DOES NOT CRASH when you save code that has import-time errors (e.g”
“Yeah, I'm inclined to leave it as an undocumented option to the run command, it's not intended for general use”
“The problem is that I had _no idea_ that lazy loading was even a thing until I dug into the source code”
“I'd like to close this in favor of making initial errors immediate. See #3431”
Failure Signature (Search String)
- In my perfect world, a bug in the app factory would cause an immediate crash on startup. But since delaying such crashes was clearly added deliberately to Flask, and has been
- * purpose: prevent the dev server from crashing due to import-time errors (after all, you're about to send another request)
Copy-friendly signature
Failure Signature
-----------------
In my perfect world, a bug in the app factory would cause an immediate crash on startup. But since delaying such crashes was clearly added deliberately to Flask, and has been there for 5 years, I do NOT propose changing this behaviour.
* purpose: prevent the dev server from crashing due to import-time errors (after all, you're about to send another request)
Error Message
Signature-only (no traceback captured)
Error Message
-------------
In my perfect world, a bug in the app factory would cause an immediate crash on startup. But since delaying such crashes was clearly added deliberately to Flask, and has been there for 5 years, I do NOT propose changing this behaviour.
* purpose: prevent the dev server from crashing due to import-time errors (after all, you're about to send another request)
Minimal Reproduction
import flask
app = flask.Flask(__nam__) # <<< TYPO!!!
@app.route('/')
def index():
return flask.make_response({"foo": 42}, 200)
What Broke
Developers face delayed visibility of bugs during application startup, leading to confusion.
Why It Broke
Flask's lazy loading feature prevents immediate crash on startup for import-time errors
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 1.1.2 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option C — Workaround Temporary workaround
for this feature: `flask run --eager-loading`. Perfect! Nothing to fix here, right?
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/pallets/flask/pull/3434
First fixed release: 1.1.2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable for applications that require immediate feedback on startup errors.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
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 |
|---|---|
| 1.1.2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.