The Fix
Upgrade to version 0.12.3 or later.
Based on closed pallets/flask issue #2594 · 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%.
@@ -118,6 +118,8 @@ Major release, unreleased
- Loading config files with ``silent=True`` will ignore ``ENOTDIR``
errors. (`#2581`_)
+- Pass ``--cert`` and ``--key`` options to ``flask run`` to run the
+ development server over HTTPS. (`#2606`_)
Option A — Upgrade to fixed release\nUpgrade to version 0.12.3 or later.\nWhen NOT to use: This fix should not be used if custom SSLContext objects are required beyond the provided options.\n\n
Why This Fix Works in Production
- Trigger: Error: no such option: --ssl_context
- Mechanism: The `flask run` command did not accept the `--ssl_context` option for HTTPS support
- Why the fix works: Added HTTPS support for the flask run command by introducing --cert and --key options. (first fixed release: 0.12.3).
- 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 `flask run` command did not accept the `--ssl_context` option for HTTPS support
- Surfaces as: Error: no such option: --ssl_context
Proof / Evidence
- GitHub issue: #2594
- Fix PR: https://github.com/pallets/flask/pull/2606
- First fixed release: 0.12.3
- 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.76
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“I'm not particularly familiar with the internals of Flask, or the Flask way of doing things, so take this with a grain of salt”
“The paths to a cert file and key file seem to be logical, since that's the behavior in Flask.run(). We pass a SSLContext object with…”
“I hope I don't sound too rude with this, but I was wondering when we can expect to see this in a release? Or on…”
“There are three behaviors: - "adhoc" generates a new self-signed cert each time - paths to a cert and key file - an SSLContext object…”
Failure Signature (Search String)
- Error: no such option: --ssl_context
Error Message
Stack trace
Error Message
-------------
Error: no such option: --ssl_context
What Broke
Users experienced errors when trying to run the server with SSL context options.
Why It Broke
The `flask run` command did not accept the `--ssl_context` option for HTTPS support
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.12.3 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/2606
First fixed release: 0.12.3
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if custom SSLContext objects are required beyond the provided options.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.12.3 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.