The Fix
Upgrade to version 2.2.0 or later.
Based on closed pallets/flask issue #4714 · 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%.
@@ -23,6 +23,10 @@ Unreleased
``g._extension_name_attr``.
+- The ``FLASK_ENV`` environment variable and ``app.env`` attribute are
+ deprecated, removing the distinction between development and debug
+ mode. Debug mode should be controlled directly using the ``--debug``
from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def index():
return 'hello world'
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 2.2.0 or later.\nWhen NOT to use: This fix is not applicable if the application relies on `FLASK_ENV` for environment configuration.\n\n
Why This Fix Works in Production
- Trigger: `FLASK_ENV=development` is very verbose, and that isn't changing with the introduction of the `--env development` option. It's much shorter to use the…
- Mechanism: Deprecates the `FLASK_ENV` environment variable and `app.env` attribute, removing the distinction between development and debug mode.
- Why the fix works: Deprecates the `FLASK_ENV` environment variable and `app.env` attribute, removing the distinction between development and debug mode. (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
- Production symptom (often without a traceback): `FLASK_ENV=development` is very verbose, and that isn't changing with the introduction of the `--env development` option. It's much shorter to use the `--debug` flag.
Proof / Evidence
- GitHub issue: #4714
- Fix PR: https://github.com/pallets/flask/pull/4720
- 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.67
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“--debug is an argument to flask, not to run. In Click, order matters, you can't mix options from one command with another.”
“I must be missing something. flask run --with-threads --host 127.0.0.1 --port 5000 --debug yields Error: No such option: --debug (Possible options: --debugger, --no-debugger)”
“Seems like setting the DEBUG config key no longer works after this change”
“Read the docs about the debug config. That is not related to this change.”
Failure Signature (Search String)
- `FLASK_ENV=development` is very verbose, and that isn't changing with the introduction of the `--env development` option. It's much shorter to use the `--debug` flag.
- I must be missing something.
Copy-friendly signature
Failure Signature
-----------------
`FLASK_ENV=development` is very verbose, and that isn't changing with the introduction of the `--env development` option. It's much shorter to use the `--debug` flag.
I must be missing something.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
`FLASK_ENV=development` is very verbose, and that isn't changing with the introduction of the `--env development` option. It's much shorter to use the `--debug` flag.
I must be missing something.
Minimal Reproduction
from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def index():
return 'hello world'
What Broke
Users experienced confusion and misconfiguration when using `FLASK_ENV` leading to incorrect debug settings.
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/4720
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 applicable if the application relies on `FLASK_ENV` for environment configuration.
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 |
|---|---|
| 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.