Jump to solution
Details

The Fix

Upgrade to version 0.49.2 or later.

Based on closed Kludex/starlette issue #3052 · PR/commit linked

Open PR/Commit
@@ -201,13 +201,10 @@ def is_not_modified(self, response_headers: Headers, request_headers: Headers) - "Not Modified" response could be returned instead. """ - try: - if_none_match = request_headers["if-none-match"] + if if_none_match := request_headers.get("if-none-match"):
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.49.2 or later.\nWhen NOT to use: Do not apply this fix if modification times can be reliably provided.\n\n

Why This Fix Works in Production

  • Trigger: staticfile caching breaks if mtimes are not available even though etags differ.
  • Mechanism: Static file caching fails when modification times are not available, leading to incorrect 304 responses
  • Why the fix works: Addresses a caching issue where static file caching breaks if modification times are not available, even when ETags differ. (first fixed release: 0.49.2).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Static file caching fails when modification times are not available, leading to incorrect 304 responses
  • Production symptom (often without a traceback): staticfile caching breaks if mtimes are not available even though etags differ.

Proof / Evidence

  • GitHub issue: #3052
  • Fix PR: https://github.com/kludex/starlette/pull/3057
  • First fixed release: 0.49.2
  • 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 have spent the day debugging into a caching problem that is already described in #2891 . This problem might not appear so bad, because usually when you change the file, the mtime of the file changes as well. I am, however currently in an”
Issue thread · issue description · source

Failure Signature (Search String)

  • staticfile caching breaks if mtimes are not available even though etags differ.
Copy-friendly signature
signature.txt
Failure Signature ----------------- staticfile caching breaks if mtimes are not available even though etags differ.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- staticfile caching breaks if mtimes are not available even though etags differ.

What Broke

Incorrect caching behavior results in 304 responses for unchanged files, causing stale content delivery.

Why It Broke

Static file caching fails when modification times are not available, leading to incorrect 304 responses

Fix Options (Details)

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

Upgrade to version 0.49.2 or later.

When NOT to use: Do not apply this fix if modification times can be reliably provided.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/kludex/starlette/pull/3057

First fixed release: 0.49.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

  • Do not apply this fix if modification times can be reliably provided.

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
0.49.2 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.