Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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``
repro.py
from flask import Flask app = Flask(__name__) app.config['DEBUG'] = True @app.route('/') def index(): return 'hello world'
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
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).
Production impact:
  • 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.”
@davidism · 2022-08-02 · source
“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)”
@GAEfan · 2022-08-02 · source
“Seems like setting the DEBUG config key no longer works after this change”
@crono782 · 2022-08-06 · source
“Read the docs about the debug config. That is not related to this change.”
@davidism · 2022-08-06 · source

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
signature.txt
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.txt
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

repro.py
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.

When NOT to use: This fix is not applicable if the application relies on `FLASK_ENV` for environment configuration.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not applicable if the application relies on `FLASK_ENV` for environment configuration.

Verify Fix

verify
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

VersionStatus
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.