Jump to solution
Verify

The Fix

Upgrade to version 3.1.2 or later.

Based on closed pallets/flask issue #5729 · 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
@@ -5,6 +5,8 @@ Unreleased - Drop support for Python 3.9. :pr:`5730` - Remove previously deprecated code: ``__version__``. :pr:`5648` +- ``template_filter``, ``template_test``, and ``template_global`` decorators + can be used without parentheses. :issue:`5729`
repro.py
from flask import Flask, render_template_string app = Flask(__name__) @app.template_filter def double(x): return x * 2 @app.route("/") def index(): return render_template_string("2 times 2 is {{ 2 | double }}")
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 3.1.2 or later.\nWhen NOT to use: This fix is not applicable if the decorator's behavior without parentheses is intended.\n\n

Why This Fix Works in Production

  • Trigger: jinja2.exceptions.TemplateAssertionError: No filter named 'double'.
  • Mechanism: The template_filter decorator fails to register without parentheses
  • Why the fix works: Enhances the App.template_filter decorator to support being called without parentheses, while maintaining backward compatibility. (first fixed release: 3.1.2).
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

  • Shows up under Python 3.11.11 in real deployments (not just unit tests).
  • The template_filter decorator fails to register without parentheses
  • Surfaces as: jinja2.exceptions.TemplateAssertionError: No filter named 'double'.

Proof / Evidence

  • GitHub issue: #5729
  • Fix PR: https://github.com/pallets/flask/pull/5736
  • First fixed release: 3.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.67

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“@alexwlchan is it okay if i take up this issue? I understand from https://palletsprojects.com/contributing that I don't have to ask first but I thought it…”
@Gable-github · 2025-05-16 · source
“Not the author of the issue (not sure why you pinged him) but a maintainer: Yes sure, feel free to work on it. PRs to…”
@ThiefMaster · 2025-05-16 · source
“Hi there! I'm keen to start contributing to Flask and this issue caught my eye”
@lekuG12 · 2025-05-22 · source
“There's already a draft PR for this... why do you want to start working on yet another one while there's an open PR? :)”
@ThiefMaster · 2025-05-22 · source

Failure Signature (Search String)

  • jinja2.exceptions.TemplateAssertionError: No filter named 'double'.

Error Message

Stack trace
error.txt
Error Message ------------- jinja2.exceptions.TemplateAssertionError: No filter named 'double'.

Minimal Reproduction

repro.py
from flask import Flask, render_template_string app = Flask(__name__) @app.template_filter def double(x): return x * 2 @app.route("/") def index(): return render_template_string("2 times 2 is {{ 2 | double }}")

Environment

  • Python: 3.11.11

What Broke

Users encounter a TemplateAssertionError when using the filter without parentheses.

Why It Broke

The template_filter decorator fails to register without parentheses

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 3.1.2 or later.

When NOT to use: This fix is not applicable if the decorator's behavior without parentheses is intended.

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/5736

First fixed release: 3.1.2

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 decorator's behavior without parentheses is intended.

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